summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-12-07 16:11:57 +0100
committerEike Rathke <erack@redhat.com>2011-12-07 16:25:35 +0100
commitac40f7d6503533954127e818f2bf009200c1e3f2 (patch)
treeb9783c88f7b0e50e94d76c90c87c3d19edb07227 /vcl
parentf378c85a705be23ddc7523c3122807393d27095a (diff)
old class Stack pop'ed 0 from empty stack, which std::stack doesn't
Some places in the code assumed that if the stack is empty a null pointer is returned by top() (or old Pop()), this doesn't work anymore with ::std::stack that instead has undefined behavior in that case, so check !stack.empty() first before accessing top.
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/cvtsvm.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index bb5628f57fa7..7efd1f6f6e82 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -1155,8 +1155,14 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case( GDI_POP_ACTION ):
{
- LineInfo* pLineInfo = aLIStack.top();
- aLIStack.pop();
+ LineInfo* pLineInfo;
+ if (aLIStack.empty())
+ pLineInfo = NULL;
+ else
+ {
+ pLineInfo = aLIStack.top();
+ aLIStack.pop();
+ }
// restore line info
if( pLineInfo )
@@ -2068,8 +2074,14 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
case( META_POP_ACTION ):
{
- Color* pCol = rLineColStack.top();
- rLineColStack.pop();
+ Color* pCol;
+ if (rLineColStack.empty())
+ pCol = NULL;
+ else
+ {
+ pCol = rLineColStack.top();
+ rLineColStack.pop();
+ }
if( pCol )
{