diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-07-16 10:50:58 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-07-17 11:08:29 +0000 |
commit | 0e5dbfa5f1213e0ae9b79f507ac78e99e35417aa (patch) | |
tree | cead8c0c708c448d9295f1885f606642c063d07a /filter | |
parent | e5aae767d634ba7efc8a5ecf2889678176babeb8 (diff) |
min size of eps for a preview is 32
Change-Id: Icb82d9dd0a3918f2bdc4cb768c566774cd0d8ac4
(cherry picked from commit bf02304a0ea4771e01f39dd0032cbf276997ca00)
Reviewed-on: https://gerrit.libreoffice.org/17132
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
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 730dd8076d49..dc269394ea43 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; |