diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-06-27 18:44:36 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-06-27 18:44:36 +0200 |
| commit | 87aaa9c3f08add01c40b830cd8293a0ad20f24dc (patch) | |
| tree | a8e262199cb2afa40e13b5a9a204a0162de2bb77 /core | |
| parent | 6836b501afdedb8fec583400ee86d379938434bc (diff) | |
ZLIB: Fix edge case where initial buffer < 258 bytes.
Diffstat (limited to 'core')
| -rw-r--r-- | core/compress/zlib/zlib.odin | 10 |
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); |