aboutsummaryrefslogtreecommitdiff
path: root/core/compress
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2021-06-27 18:44:36 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2021-06-27 18:44:36 +0200
commit87aaa9c3f08add01c40b830cd8293a0ad20f24dc (patch)
treea8e262199cb2afa40e13b5a9a204a0162de2bb77 /core/compress
parent6836b501afdedb8fec583400ee86d379938434bc (diff)
ZLIB: Fix edge case where initial buffer < 258 bytes.
Diffstat (limited to 'core/compress')
-rw-r--r--core/compress/zlib/zlib.odin10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/compress/zlib/zlib.odin b/core/compress/zlib/zlib.odin
index c9439b285..0de9a6ec6 100644
--- a/core/compress/zlib/zlib.odin
+++ b/core/compress/zlib/zlib.odin
@@ -502,12 +502,10 @@ inflate_from_context :: proc(using ctx: ^compress.Context_Memory_Input, raw := f
inflate_raw :: proc(z: ^$C, expected_output_size := -1, allocator := context.allocator) -> (err: Error) #no_bounds_check {
expected_output_size := expected_output_size;
- if expected_output_size <= 0 {
- /*
- Always set up a minimum allocation size.
- */
- expected_output_size = compress.COMPRESS_OUTPUT_ALLOCATE_MIN;
- }
+ /*
+ Always set up a minimum allocation size.
+ */
+ expected_output_size = max(max(expected_output_size, compress.COMPRESS_OUTPUT_ALLOCATE_MIN), 512);
// fmt.printf("\nZLIB: Expected Payload Size: %v\n\n", expected_output_size);