mirror of
https://github.com/lz4/lz4.git
synced 2024-12-03 06:43:43 +08:00
Restored variable output size fuzzer test
Quickfix frame decompression Small speed optimization frame decompression
This commit is contained in:
parent
56c2b79ed0
commit
457dc35e6a
23
lz4frame.c
23
lz4frame.c
@ -775,15 +775,6 @@ static void LZ4F_saveDict(LZ4F_dctx_internal_t* dctxPtr, const BYTE* decoded, si
|
||||
|
||||
static void LZ4F_pointDict(LZ4F_dctx_internal_t* dctxPtr, const BYTE* decoded, size_t decodedSize)
|
||||
{
|
||||
/* large decoded block */
|
||||
if (decodedSize >= (64 KB - 1))
|
||||
{
|
||||
dctxPtr->dict = (BYTE*)decoded;
|
||||
dctxPtr->dictSize = decodedSize;
|
||||
dctxPtr->tmpOut = dctxPtr->tmpOutBuffer + 64 KB;
|
||||
return;
|
||||
}
|
||||
|
||||
/* decoded block in the continuity of dictionary */
|
||||
if (dctxPtr->dict + dctxPtr->dictSize == decoded)
|
||||
{
|
||||
@ -800,6 +791,15 @@ static void LZ4F_pointDict(LZ4F_dctx_internal_t* dctxPtr, const BYTE* decoded, s
|
||||
return;
|
||||
}
|
||||
|
||||
/* large decoded block */
|
||||
if (decodedSize >= (64 KB - 1))
|
||||
{
|
||||
dctxPtr->dict = (BYTE*)decoded;
|
||||
dctxPtr->dictSize = decodedSize;
|
||||
dctxPtr->tmpOut = dctxPtr->tmpOutBuffer + 64 KB;
|
||||
return;
|
||||
}
|
||||
|
||||
/* small block, and not contiguous : let's save that */
|
||||
LZ4F_saveDict(dctxPtr, decoded, decodedSize);
|
||||
}
|
||||
@ -953,6 +953,11 @@ size_t LZ4F_decompress(LZ4F_decompressionContext_t decompressionContext,
|
||||
break;
|
||||
}
|
||||
dctxPtr->dStage = dstage_getCBlock;
|
||||
if (dstPtr==dstEnd)
|
||||
{
|
||||
nextSrcSizeHint = nextCBlockSize + 4;
|
||||
doAnotherStage = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -466,12 +466,11 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi
|
||||
while (ip < iend)
|
||||
{
|
||||
unsigned nbBitsI = (FUZ_rand(&randState) % (maxBits-1)) + 1;
|
||||
unsigned nbBitsO = (FUZ_rand(&randState) % (maxBits-1)) + 1;
|
||||
unsigned nbBitsO = (FUZ_rand(&randState) % (maxBits)) + 1;
|
||||
size_t iSize = (FUZ_rand(&randState) & ((1<<nbBitsI)-1)) + 1;
|
||||
size_t oSize = (FUZ_rand(&randState) & ((1<<nbBitsO)-1)) + 1;
|
||||
size_t oSize = (FUZ_rand(&randState) & ((1<<nbBitsO)-1)) + 2;
|
||||
if (iSize > (size_t)(iend-ip)) iSize = iend-ip;
|
||||
if (oSize > (size_t)(oend-op)) oSize = oend-op;
|
||||
oSize = oend-op;
|
||||
result = LZ4F_decompress(dCtx, op, &oSize, ip, &iSize, NULL);
|
||||
if (result == (size_t)-ERROR_checksum_invalid) locateBuffDiff((BYTE*)srcBuffer+srcStart, decodedBuffer, srcSize);
|
||||
CHECK(LZ4F_isError(result), "Decompression failed (error %i)", (int)result);
|
||||
|
Loading…
Reference in New Issue
Block a user