[Libreoffice-commits] core.git: 2 commits - filter/qa filter/source

Caolán McNamara caolanm at redhat.com
Fri Jul 17 02:01:13 PDT 2015


 dev/null                                     |binary
 filter/qa/cppunit/data/tiff/fail/hang-2.tiff |binary
 filter/qa/cppunit/data/tiff/fail/hang-3.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx  |   11 ++++++++++-
 4 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 64cc2d775c0b2347a55e563c362c37e033ffd68d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 17 10:00:21 2015 +0100

    rename test case
    
    Change-Id: I76d35955a1d024d05a94ffdfdcf8e4076de24975

diff --git a/filter/qa/cppunit/data/tiff/fail/loop.tif b/filter/qa/cppunit/data/tiff/fail/hang-3.tiff
similarity index 100%
rename from filter/qa/cppunit/data/tiff/fail/loop.tif
rename to filter/qa/cppunit/data/tiff/fail/hang-3.tiff
commit 49bf2c6700d8f0fc9155ac2d06bf0a7bd84915d8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 17 09:59:23 2015 +0100

    detect another loop in tif format
    
    Change-Id: I950f751277d9080b4fc00c38f63453cce81bcc32

diff --git a/filter/qa/cppunit/data/tiff/fail/hang-2.tiff b/filter/qa/cppunit/data/tiff/fail/hang-2.tiff
new file mode 100644
index 0000000..28ec8c0
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/hang-2.tiff differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index e132fab..aed15f6 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1181,10 +1181,19 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
     {
         sal_uInt32 nOffset = nFirstIfd;
 
+        std::vector<sal_uInt32> aSeenOffsets;
         // calculate length of TIFF file
         do
         {
-            pTIFF->Seek( nOrigPos + nOffset );
+            if (std::find(aSeenOffsets.begin(), aSeenOffsets.end(), nOffset) != aSeenOffsets.end())
+            {
+                SAL_WARN("filter.tiff", "Parsing error: " << nOffset <<
+                         " already processed, format loop");
+                bStatus = false;
+                break;
+            }
+            pTIFF->Seek(nOrigPos + nOffset);
+            aSeenOffsets.push_back(nOffset);
 
             if( pTIFF->GetError() )
             {


More information about the Libreoffice-commits mailing list