diff options
author | Eike Rathke <erack@redhat.com> | 2011-12-07 16:11:57 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2011-12-07 17:27:31 +0100 |
commit | cabf25372cf98869616c3d583eb99fa5f5eb3a8f (patch) | |
tree | 477ad848a6c40141f00c84e6bbfc0375c4517cfd /vcl | |
parent | d432b00bfa05b1bd1413fb0b9afac19de5c1f60b (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.
(cherry picked from commit ac40f7d6503533954127e818f2bf009200c1e3f2)
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/cvtsvm.cxx | 20 |
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 ) { |