diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-27 14:40:37 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-31 15:11:45 +0200 |
commit | cffed0c4b50a568ad206d59e21f7d08176e73379 (patch) | |
tree | 43d01969b99f40ddbb75f2bd2eced124b632a2d1 /filter | |
parent | 8486d4f6ed1aba6b61e055a5bd7bc66bfcf2f564 (diff) |
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/18095
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'filter')
-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; } |