diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/metaact.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/svmconverter.cxx | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 7bfa151fe3ec..ac229f0f3c51 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1114,7 +1114,7 @@ MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt, { const sal_Int32 nAryLen = pDXAry ? mnLen : 0; - if( nAryLen ) + if (nAryLen > 0) { mpDXAry = new long[ nAryLen ]; memcpy( mpDXAry, pDXAry, nAryLen * sizeof(long) ); diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index b1a1c7aedddd..3a6e961c0676 100644 --- a/vcl/source/gdi/svmconverter.cxx +++ b/vcl/source/gdi/svmconverter.cxx @@ -908,6 +908,15 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) std::unique_ptr<long[]> pDXAry; if (nAryLen > 0) { + const size_t nMinRecordSize = sizeof(sal_Int32); + const size_t nMaxRecords = rIStm.remainingSize() / nMinRecordSize; + if (static_cast<sal_uInt32>(nAryLen) > nMaxRecords) + { + SAL_WARN("vcl.gdi", "Parsing error: " << nMaxRecords << + " max possible entries, but " << nAryLen << " claimed, truncating"); + nAryLen = nMaxRecords; + } + sal_Int32 nStrLen( aStr.getLength() ); pDXAry.reset(new long[ std::max( nAryLen, nStrLen ) ]); |