vcl/source/filter/GraphicFormatDetector.cxx |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 85013c57dd29e32ec0411c159ea72824ebca5aa9
Author:     Paris Oplopoios <paris.oplopo...@collabora.com>
AuthorDate: Sat Jun 24 03:48:32 2023 +0300
Commit:     Paris Oplopoios <parisop...@gmail.com>
CommitDate: Sat Jun 24 12:16:34 2023 +0200

    tdf#156016 Fix bug where SVG check size would be 0
    
    Change-Id: I1c4adf75bbfbce7cb6b779375714b1c1bc7ec50d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153543
    Tested-by: Jenkins
    Reviewed-by: Paris Oplopoios <parisop...@gmail.com>

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index 4fc2c85c2a4e..d4a027d60ed3 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -1272,7 +1272,7 @@ bool GraphicFormatDetector::checkSVG()
                                                       SVG_CHECK_SIZE, 
nDecompressedSize);
     nCheckSize = std::min<sal_uInt64>(nDecompressedSize, 256);
     bool bIsSvg(false);
-    bool bIsGZip = (nDecompressedSize > 0);
+    bool bIsGZip = mbWasCompressed;
     const char* pCheckArrayAsCharArray = reinterpret_cast<char*>(pCheckArray);
     // check for XML
     // #119176# SVG files which have no xml header at all have shown up this 
is optional
@@ -1302,11 +1302,11 @@ bool GraphicFormatDetector::checkSVG()
 
         if (bIsGZip)
         {
-            nCheckSize = std::min<sal_uInt64>(nDecompressedSize, 2048);
+            nCheckSize = std::min<sal_uInt64>(nDecompressedSize, 
SVG_CHECK_SIZE);
         }
         else
         {
-            nCheckSize = std::min<sal_uInt64>(mnStreamLength, 2048);
+            nCheckSize = std::min<sal_uInt64>(mnStreamLength, SVG_CHECK_SIZE);
             mrStream.Seek(mnStreamPosition);
             nCheckSize = mrStream.ReadBytes(sExtendedOrDecompressedFirstBytes, 
nCheckSize);
         }
@@ -1423,7 +1423,6 @@ sal_uInt8* 
GraphicFormatDetector::checkAndUncompressBuffer(sal_uInt8* aUncompres
         mbWasCompressed = true;
         return aUncompressedBuffer;
     }
-    nRetSize = 0;
     mbWasCompressed = false;
     return maFirstBytes.data();
 }

Reply via email to