mirror of
https://github.com/cuberite/libdeflate.git
synced 2025-08-04 02:06:31 -04:00
deflate_compress: don't pass NULL to memcpy on empty input
This commit is contained in:
parent
2b047b097b
commit
0205f005bc
@ -2787,6 +2787,8 @@ libdeflate_deflate_compress(struct libdeflate_compressor *c,
|
||||
if (unlikely(in_nbytes < 16)) {
|
||||
struct deflate_output_bitstream os;
|
||||
deflate_init_output(&os, out, out_nbytes_avail);
|
||||
if (in_nbytes == 0)
|
||||
in = &os; /* Avoid passing NULL to memcpy() */
|
||||
deflate_write_uncompressed_block(&os, in, in_nbytes, true);
|
||||
return deflate_flush_output(&os);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user