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

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


 filter/qa/cppunit/data/tiff/fail/loop.tif   |binary
 filter/source/graphicfilter/itiff/itiff.cxx |   12 +++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 96aaf7114df2da0b7bdc86f5feef6137c7c1e44b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 17 09:23:17 2015 +0100

    detect loop in tif format
    
    Change-Id: I27645566cd9fc0ac8cf753f0217ae6cf0fa9929e
    (cherry picked from commit 290465b0effecb6d620adc20ca279f8057eeab9a)
    Reviewed-on: https://gerrit.libreoffice.org/17149
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/filter/qa/cppunit/data/tiff/fail/loop.tif b/filter/qa/cppunit/data/tiff/fail/loop.tif
new file mode 100644
index 0000000..6d8cee7
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/loop.tif differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 84bff73..9ae2a06 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1210,9 +1210,19 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
         }
         while( nOffset );
 
+        std::vector<sal_uInt32> aSeenIfds;
+
         for ( sal_uInt32 nNextIfd = nFirstIfd; nNextIfd && bStatus; )
         {
-            pTIFF->Seek( nOrigPos + nNextIfd );
+            if (std::find(aSeenIfds.begin(), aSeenIfds.end(), nNextIfd) != aSeenIfds.end())
+            {
+                SAL_WARN("filter.tiff", "Parsing error: " << nNextIfd <<
+                         " already processed, format loop");
+                bStatus = false;
+                break;
+            }
+            pTIFF->Seek(nOrigPos + nNextIfd);
+            aSeenIfds.push_back(nNextIfd);
             {
                 bByteSwap = false;
 


More information about the Libreoffice-commits mailing list