diff options
author | Yann Collet <cyan@fb.com> | 2020-09-26 18:31:57 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2020-09-26 18:31:57 (GMT) |
commit | ee4f37d2840c1faa41fb7110bbf6d1e58bf30ace (patch) | |
tree | b1b330a8246b826f84dc48bdc4982fcdbe833d8e /lib/lz4.c | |
parent | 20856da7c571cc1ee55965a342527f8263dc356d (diff) | |
download | lz4-ee4f37d2840c1faa41fb7110bbf6d1e58bf30ace.zip lz4-ee4f37d2840c1faa41fb7110bbf6d1e58bf30ace.tar.gz lz4-ee4f37d2840c1faa41fb7110bbf6d1e58bf30ace.tar.bz2 |
fix compressing into NULL
fails properly
bug discovered by oss-fuzz
Diffstat (limited to 'lib/lz4.c')
-rw-r--r-- | lib/lz4.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1236,6 +1236,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; } /* Unsupported srcSize, too large (or negative) */ if (srcSize == 0) { /* src == NULL supported if srcSize == 0 */ + if (outputDirective != notLimited && dstCapacity <= 0) return 0; /* no output, can't write anything */ DEBUGLOG(5, "Generating an empty block"); assert(outputDirective == notLimited || dstCapacity >= 1); assert(dst != NULL); |