summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-07-13 20:44:16 +0100
committerDavid Tardon <dtardon@redhat.com>2015-07-14 08:31:26 +0000
commit729ba6999667fea9bc4ee6966f63368726a290f5 (patch)
tree744eeae45429a408de3b7881c3ea0110544ef7d1 /vcl/source
parentd67271d6e1d0b151fdfaa117ff9297ac88ff5f3b (diff)
fix a third emf crash
Change-Id: I3b5d0daf05e3272d2afa0da84ff0b1f8d5c965a4 (cherry picked from commit 173fd90387e8bb7f33c2608628f12c7f772f0277) Reviewed-on: https://gerrit.libreoffice.org/17022 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/filter/wmf/enhwmf.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index dcd802c6c46d..c20ab5f640cf 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -1441,7 +1441,9 @@ bool EnhWMFReader::ReadEnhWMF()
DBG_ASSERT( ( nOptions & ( ETO_PDY | ETO_GLYPH_INDEX ) ) == 0, "SJ: ETO_PDY || ETO_GLYPH_INDEX in EMF" );
Point aPos( ptlReferenceX, ptlReferenceY );
- if ( nLen > 0 && nLen < static_cast<sal_Int32>( SAL_MAX_UINT32 / sizeof(sal_Int32) ) )
+ bool bLenSane = nLen > 0 && nLen < static_cast<sal_Int32>( SAL_MAX_UINT32 / sizeof(sal_Int32) );
+ bool bOffStringSane = nOffString <= nEndPos - nCurPos;
+ if (bLenSane && bOffStringSane)
{
if ( offDx && (( nCurPos + offDx + nLen * 4 ) <= nNextPos ) )
{