From 9de91110821bf860bf18dd09e8f2ae1a03c117c4 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Mon, 21 Jun 2021 22:15:04 +0200 Subject: [PATCH] ZLIB: fix. --- core/compress/zlib/zlib.odin | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/core/compress/zlib/zlib.odin b/core/compress/zlib/zlib.odin index 956ddaca1..22d2e3f47 100644 --- a/core/compress/zlib/zlib.odin +++ b/core/compress/zlib/zlib.odin @@ -16,7 +16,7 @@ import "core:io" import "core:bytes" import "core:hash" -when #config(TRACY_ENABLE, false) { import tracy "shared:odin-tracy" } +// when #config(TRACY_ENABLE, false) { import tracy "shared:odin-tracy" } /* zlib.inflate decompresses a ZLIB stream passed in as a []u8 or io.Stream. @@ -360,13 +360,9 @@ parse_huffman_block :: proc(z: ^Context, z_repeat, z_offset: ^Huffman_Table) -> Replicate the last outputted byte, length times. */ if length > 0 { - if offset >= 0 && offset < z.window_size { - c := z.last[offset]; - e := repl_byte(z, length, c); - if e != .None { - return E_General.Output_Too_Short; - } - } else { + c := z.last[offset & z.window_mask]; + e := repl_byte(z, length, c); + if e != .None { return E_General.Output_Too_Short; } } @@ -376,14 +372,6 @@ parse_huffman_block :: proc(z: ^Context, z_repeat, z_offset: ^Huffman_Table) -> if e != .None { return E_General.Output_Too_Short; } - // #no_bounds_check for _ in 0..