diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-27 14:40:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-27 14:45:04 +0100 |
commit | 7e373e92fc02393732422d05264dd5115076183f (patch) | |
tree | 0fbd069749b25fead4f23c14971c309745e099b7 | |
parent | 932f6de91904f86f38d2914b9ce07b94dfadac0c (diff) |
crashtesting: tiff loop detection too slow
moz323894-1.tiff and moz456356-1.tiff take too long to load
Change-Id: Iaafa064fd05e4a4152004e7ceb6256af68aeef01
-rw-r--r-- | filter/source/graphicfilter/itiff/lzwdecom.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx b/filter/source/graphicfilter/itiff/lzwdecom.cxx index 5fb7514d62db..dc437e27e678 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; } |