[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - filter/qa filter/source

Caolán McNamara caolanm at redhat.com
Fri Jul 17 04:08:54 PDT 2015


 filter/qa/cppunit/data/eps/fail/short-1.eps |binary
 filter/source/graphicfilter/ieps/ieps.cxx   |   16 +++++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 0e5dbfa5f1213e0ae9b79f507ac78e99e35417aa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 16 10:50:58 2015 +0100

    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 at libreoffice.org>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/filter/qa/cppunit/data/eps/fail/short-1.eps b/filter/qa/cppunit/data/eps/fail/short-1.eps
new file mode 100644
index 0000000..4b38b78
Binary files /dev/null and b/filter/qa/cppunit/data/eps/fail/short-1.eps differ
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index 730dd80..dc26939 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;


More information about the Libreoffice-commits mailing list