diff --git a/NEWS b/NEWS index 4fbad22..edc8702 100644 --- a/NEWS +++ b/NEWS @@ -152,3 +152,7 @@ v1.5.5: * bz3_decompress (API) and the CLI: reject block headers with negative sizes or original sizes exceeding the block size. * lzp/rle decoders: fix integer overflows in match and run length accumulation on malformed input (#191, #192). * ci: weekly scheduled builds, dependabot for GitHub Actions, fix clang builds on armv6. + +v1.5.6: +* bz3_bound (API): increase the constant slack from 32 to 50 bytes. Previously, `bz3_compress` could write up + to 4 bytes past an output buffer of exactly `bz3_bound(in_size)` bytes for small, incompressible inputs. diff --git a/src/libbz3.c b/src/libbz3.c index e5a7896..501e2c9 100644 --- a/src/libbz3.c +++ b/src/libbz3.c @@ -514,7 +514,7 @@ BZIP3_API s8 bz3_last_error(struct bz3_state * state) { return state->last_error BZIP3_API const char * bz3_version(void) { return VERSION; } -BZIP3_API size_t bz3_bound(size_t input_size) { return input_size + input_size / 50 + 32; } +BZIP3_API size_t bz3_bound(size_t input_size) { return input_size + input_size / 50 + 50; } BZIP3_API const char * bz3_strerror(struct bz3_state * state) { switch (state->last_error) {