Kaydet (Commit) cffed0c4 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

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 7e373e92)
Reviewed-on: https://gerrit.libreoffice.org/18095Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 8486d4f6
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment