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

Caolán McNamara caolanm at redhat.com
Fri Aug 28 02:41:50 PDT 2015


 filter/source/graphicfilter/itiff/lzwdecom.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 5e3b4e302afd36b382a1d177c434fcada21ed2d4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 27 14:40:37 2015 +0100

    crashtesting: tiff loop detection too slow
    
    moz323894-1.tiff and moz456356-1.tiff take too long to load
    
    Change-Id: Iaafa064fd05e4a4152004e7ceb6256af68aeef01
    (cherry picked from commit 7e373e92fc02393732422d05264dd5115076183f)
    Reviewed-on: https://gerrit.libreoffice.org/18082
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx b/filter/source/graphicfilter/itiff/lzwdecom.cxx
index 5fb7514..dc437e2 100644
--- a/filter/source/graphicfilter/itiff/lzwdecom.cxx
+++ b/filter/source/graphicfilter/itiff/lzwdecom.cxx
@@ -20,7 +20,7 @@
 
 #include "lzwdecom.hxx"
 #include <algorithm>
-#include <vector>
+#include <set>
 
 #define MAX_TABLE_SIZE 4096
 
@@ -163,16 +163,16 @@ void LZWDecompressor::AddToTable(sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData
         return;
     }
 
-    std::vector<sal_uInt16> aSeenIndexes;
+    unsigned char aSeenIndexes[MAX_TABLE_SIZE] = {0};
     while (pTable[nCodeFirstData].nDataCount>1)
     {
-        if (std::find(aSeenIndexes.begin(), aSeenIndexes.end(), nCodeFirstData) != aSeenIndexes.end())
+        if (aSeenIndexes[nCodeFirstData])
         {
             SAL_WARN("filter.tiff", "Loop in chain");
             bEOIFound = true;
             return;
         }
-        aSeenIndexes.push_back(nCodeFirstData);
+        aSeenIndexes[nCodeFirstData] = 1;
         nCodeFirstData=pTable[nCodeFirstData].nPrevCode;
     }
 


More information about the Libreoffice-commits mailing list