LZ4F_compressFrame : fix potential crash on selecting custom preferences
frame fuzzer tests : new random tests using LZ4F_compressFrame
This commit is contained in:
parent
0e6151b137
commit
6e1049872a
@ -262,7 +262,7 @@ size_t LZ4F_compressFrame(void* dstBuffer, size_t dstMaxSize, const void* srcBuf
|
||||
|
||||
|
||||
cctxI.version = LZ4F_VERSION;
|
||||
cctxI.maxBufferSize = 64 KB; /* mess with real buffer size to prevent allocation; works because autoflush==1 & stableSrc==1 */
|
||||
cctxI.maxBufferSize = 5 MB; /* mess with real buffer size to prevent allocation; works because autoflush==1 & stableSrc==1 */
|
||||
|
||||
if (preferencesPtr!=NULL) prefs = *preferencesPtr;
|
||||
{
|
||||
|
@ -426,6 +426,14 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi
|
||||
DISPLAYUPDATE(2, "\r%5i ", testNb);
|
||||
crcOrig = XXH64((BYTE*)srcBuffer+srcStart, srcSize, 1);
|
||||
|
||||
if ((FUZ_rand(&randState)&0xF) == 2)
|
||||
{
|
||||
LZ4F_preferences_t* framePrefs = &prefs;
|
||||
if ((FUZ_rand(&randState)&7) == 1) framePrefs = NULL;
|
||||
cSize = LZ4F_compressFrame(compressedBuffer, LZ4F_compressFrameBound(srcSize, framePrefs), srcBuffer + srcStart, srcSize, framePrefs);
|
||||
CHECK(LZ4F_isError(cSize), "LZ4F_compressFrame failed : error %i (%s)", (int)cSize, LZ4F_getErrorName(cSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
const BYTE* ip = (const BYTE*)srcBuffer + srcStart;
|
||||
const BYTE* const iend = ip + srcSize;
|
||||
|
Loading…
Reference in New Issue
Block a user