:: commit ba14bd9614efd0d5100062adc3315c5d14a8f52f

Kamila Szewczyk <27734421+kspalaiologos@users.noreply.github.com> — 2023-12-20 06:26

parents: 7e73218ef4

Fix for #120

diff --git a/src/libbz3.c b/src/libbz3.c
index 15c327a..ab65df8 100644
--- a/src/libbz3.c
+++ b/src/libbz3.c
@@ -804,7 +804,7 @@ BZIP3_API int bz3_compress(u32 block_size, const u8 * const in, u8 * out, size_t
     struct bz3_state * state = bz3_new(block_size);
     if (!state) return BZ3_ERR_INIT;
 
-    u8 * compression_buf = malloc(block_size);
+    u8 * compression_buf = malloc(bz3_bound(block_size));
     if (!compression_buf) {
         bz3_free(state);
         return BZ3_ERR_INIT;
tab: 248 wrap: offon