diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-05-01 21:56:45 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-05-01 21:56:45 +0200 |
| commit | 2ad8f99790dda7d021202b9d7830d24d80d4e331 (patch) | |
| tree | 0207a623451d90fc108b17acb5a304d868812133 /core | |
| parent | 0a0ba95e858a985637bf6060b7369fd2637af7a2 (diff) | |
ZLIB level 0: LEN/NLEN = i16.
Diffstat (limited to 'core')
| -rw-r--r-- | core/compress/zlib/zlib.odin | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/compress/zlib/zlib.odin b/core/compress/zlib/zlib.odin index 5ce1f26ad..252470f7a 100644 --- a/core/compress/zlib/zlib.odin +++ b/core/compress/zlib/zlib.odin @@ -446,7 +446,7 @@ inflate_from_stream_raw :: proc(z: ^Context, allocator := context.allocator) -> final = compress.read_bits_lsb(z, 1); type = compress.read_bits_lsb(z, 2); - // log.debugf("Final: %v | Type: %v\n", final, type); + // fmt.printf("Final: %v | Type: %v\n", final, type); switch type { case 0: @@ -455,9 +455,13 @@ inflate_from_stream_raw :: proc(z: ^Context, allocator := context.allocator) -> // Discard bits until next byte boundary compress.discard_to_next_byte_lsb(z); - uncompressed_len := int(compress.read_bits_lsb(z, 16)); - length_check := int(compress.read_bits_lsb(z, 16)); - if uncompressed_len != ~length_check { + uncompressed_len := i16(compress.read_bits_lsb(z, 16)); + length_check := i16(compress.read_bits_lsb(z, 16)); + + // fmt.printf("LEN: %v, ~LEN: %v, NLEN: %v, ~NLEN: %v\n", uncompressed_len, ~uncompressed_len, length_check, ~length_check); + + + if ~uncompressed_len != length_check { return E_Deflate.Len_Nlen_Mismatch; } |