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

Caolán McNamara caolanm at redhat.com
Fri Jul 17 05:21:00 PDT 2015


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

New commits:
commit ce52c9dcc3eaec8c8e4c72b1c5933d3ca2fbb384
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
    (cherry picked from commit 49bf2c6700d8f0fc9155ac2d06bf0a7bd84915d8)
    Reviewed-on: https://gerrit.libreoffice.org/17155
    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/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 92d7a3c..6d1be66 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1197,10 +1197,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