Lizard (formerly LZ5) is an efficient compressor with very fast decompression. It achieves compression ratio that is comparable to zip/zlib and zstd/brotli (at low and medium compression levels) at decompression speed of 1000 MB/s and faster.
Other
644
stars
40
forks
source link
Lizard_createStream doesn't initialize all members #12
After calling:
if(Lizard_stream_t *lizard=Lizard_createStream(Mid(compression_level, LIZARD_MIN_CLEVEL, LIZARD_MAX_CLEVEL)))
I get some uninitialized values, like lizard->end
which caused crashes in subsequent call to 'Lizard_compress_continue'
After I changed the code to zero the context, the crashes disappeared
Also your codes calculated this "sizeof(Lizard_stream_t) + hashTableSize + chainTableSize + LIZARD_COMPRESS_ADD_BUF + LIZARD_COMPRESS_ADD_HUF" several times, it's better to compute this once into a helper variable first.
Also I suggest removing all "printf" calls from your library, and either use some error code result enums, or an optional callback which accepts the messages.
After calling:
if(Lizard_stream_t *lizard=Lizard_createStream(Mid(compression_level, LIZARD_MIN_CLEVEL, LIZARD_MAX_CLEVEL)))
I get some uninitialized values, like lizard->end which caused crashes in subsequent call to 'Lizard_compress_continue'After I changed the code to zero the context, the crashes disappeared
Also your codes calculated this "sizeof(Lizard_stream_t) + hashTableSize + chainTableSize + LIZARD_COMPRESS_ADD_BUF + LIZARD_COMPRESS_ADD_HUF" several times, it's better to compute this once into a helper variable first.
Also I suggest removing all "printf" calls from your library, and either use some error code result enums, or an optional callback which accepts the messages.