summaryrefslogtreecommitdiffstats
path: root/programs/frametest.c
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2014-09-22 01:59:42 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2014-09-22 01:59:42 (GMT)
commit6e1049872ae2606cfb3820464c850c694275ae59 (patch)
tree9aa742ad19a0cebceba94a403ec8dd09e974b6e6 /programs/frametest.c
parent0e6151b1379ed8e60c1ca345497c86f88e3967f6 (diff)
downloadlz4-6e1049872ae2606cfb3820464c850c694275ae59.zip
lz4-6e1049872ae2606cfb3820464c850c694275ae59.tar.gz
lz4-6e1049872ae2606cfb3820464c850c694275ae59.tar.bz2
LZ4F_compressFrame : fix potential crash on selecting custom preferences
frame fuzzer tests : new random tests using LZ4F_compressFrame
Diffstat (limited to 'programs/frametest.c')
-rw-r--r--programs/frametest.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/programs/frametest.c b/programs/frametest.c
index 03b47e8..aa1a727 100644
--- a/programs/frametest.c
+++ b/programs/frametest.c
@@ -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;