diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-07-16 10:50:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-07-16 16:32:11 +0100 |
commit | bf02304a0ea4771e01f39dd0032cbf276997ca00 (patch) | |
tree | 9d693cace83676e090b71853ec09e99f32333584 /filter | |
parent | 1f366b13f766e588e58ee6ebe67149fb8028f3ee (diff) |
min size of eps for a preview is 32
Change-Id: Icb82d9dd0a3918f2bdc4cb768c566774cd0d8ac4
Diffstat (limited to 'filter')
-rw-r--r-- | filter/qa/cppunit/data/eps/fail/short-1.eps | bin | 0 -> 29 bytes | |||
-rw-r--r-- | filter/source/graphicfilter/ieps/ieps.cxx | 16 |
2 files changed, 9 insertions, 7 deletions
diff --git a/filter/qa/cppunit/data/eps/fail/short-1.eps b/filter/qa/cppunit/data/eps/fail/short-1.eps Binary files differnew file mode 100644 index 000000000000..4b38b782f6fd --- /dev/null +++ b/filter/qa/cppunit/data/eps/fail/short-1.eps diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index 634983fffc3b..ddabfc7703ea 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -69,7 +69,7 @@ static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, // SecurityCount is the buffersize of the buffer in which we will parse for a number -static long ImplGetNumber( sal_uInt8 **pBuf, int& nSecurityCount ) +static long ImplGetNumber( sal_uInt8 **pBuf, sal_uInt32& nSecurityCount ) { bool bValid = true; bool bNegative = false; @@ -502,7 +502,7 @@ void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead, if ( pDest ) { pDest += 16; - int nCount = 4; + sal_uInt32 nCount = 4; long nNumber = ImplGetNumber( &pDest, nCount ); if ( nCount && ( (sal_uInt32)nNumber < 10 ) ) { @@ -595,14 +595,16 @@ GraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* ) rStream.Seek( nPSStreamPos ); sal_uInt8* pBuf = new sal_uInt8[ nPSSize ]; - sal_uInt32 nBufStartPos = rStream.Tell(); - sal_uInt32 nBytesRead = rStream.Read( pBuf, nPSSize ); + sal_uInt32 nBufStartPos = rStream.Tell(); + sal_uInt32 nBytesRead = rStream.Read( pBuf, nPSSize ); if ( nBytesRead == nPSSize ) { - int nSecurityCount = 32; - if ( !bHasPreview ) // if there is no tiff/wmf preview, we will parse for an preview in the eps prolog + sal_uInt32 nSecurityCount = 32; + // if there is no tiff/wmf preview, we will parse for an preview in + // the eps prolog + if (!bHasPreview && nBytesRead >= nSecurityCount) { - sal_uInt8* pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%BeginPreview:"), nBytesRead - 32, 15 ); + sal_uInt8* pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%BeginPreview:"), nBytesRead - nSecurityCount, 15 ); if ( pDest ) { pDest += 15; |