Kaydet (Commit) 59197f18 authored tarafından Caolán McNamara's avatar Caolán McNamara

use same limit in ProcessOneCode as AddToTable

Change-Id: Id0345e5d867d18bf7eb341f04086226b7fa79680
üst 2f0d1a23
...@@ -109,11 +109,9 @@ HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize, ...@@ -109,11 +109,9 @@ HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize,
bool GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData ) bool GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData )
{ {
GIFLZWTableEntry* pE;
if( nTableSize < 4096 ) if( nTableSize < 4096 )
{ {
pE = pTable + nTableSize; GIFLZWTableEntry* pE = pTable + nTableSize;
pE->pPrev = pTable + nPrevCode; pE->pPrev = pTable + nPrevCode;
pE->pFirst = pE->pPrev->pFirst; pE->pFirst = pE->pPrev->pFirst;
GIFLZWTableEntry *pEntry = pTable[nCodeFirstData].pFirst; GIFLZWTableEntry *pEntry = pTable[nCodeFirstData].pFirst;
...@@ -130,7 +128,6 @@ bool GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 nCodeFirst ...@@ -130,7 +128,6 @@ bool GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 nCodeFirst
bool GIFLZWDecompressor::ProcessOneCode() bool GIFLZWDecompressor::ProcessOneCode()
{ {
GIFLZWTableEntry* pE;
sal_uInt16 nCode; sal_uInt16 nCode;
bool bRet = false; bool bRet = false;
bool bEndOfBlock = false; bool bEndOfBlock = false;
...@@ -193,11 +190,11 @@ bool GIFLZWDecompressor::ProcessOneCode() ...@@ -193,11 +190,11 @@ bool GIFLZWDecompressor::ProcessOneCode()
nOldCode = nCode; nOldCode = nCode;
if (nCode > 4096) if (nCode >= 4096)
return false; return false;
// write character(/-sequence) of code nCode in the output buffer: // write character(/-sequence) of code nCode in the output buffer:
pE = pTable + nCode; GIFLZWTableEntry* pE = pTable + nCode;
do do
{ {
if (pOutBufData == pOutBuf) //can't go back past start if (pOutBufData == pOutBuf) //can't go back past start
......
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