diff options
| author | Clement Sibille <clements+git@lisible.xyz> | 2024-02-27 17:23:33 +0900 |
|---|---|---|
| committer | Clement Sibille <clements+git@lisible.xyz> | 2024-02-27 17:23:33 +0900 |
| commit | e1e5b4e92bcd460b43ce1b852560751b6525593e (patch) | |
| tree | 4b8bef35e0621240c6531ee28abb55a42e1a70f4 /lisiblepng/src/bitstream.c | |
| parent | 228854f8672d5015550ab6f6c76e806d099bb4db (diff) | |
Implement Deflate decompression
This patch adds the decompression code for zlib compressed data streams
that are compressed using Deflate based on RFC-1950 and RFC-1951.
This implementation lacks support for zlib prefix dictionaries and for
non-compressed Deflate blocks as these are less common.
Diffstat (limited to 'lisiblepng/src/bitstream.c')
| -rw-r--r-- | lisiblepng/src/bitstream.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lisiblepng/src/bitstream.c b/lisiblepng/src/bitstream.c index b34a890..e7ddb79 100644 --- a/lisiblepng/src/bitstream.c +++ b/lisiblepng/src/bitstream.c @@ -30,8 +30,7 @@ void Bitstream_skip(Bitstream *bitstream, size_t bit_count) { uint16_t Bitstream_next_bits(Bitstream *bitstream, int bit_count) { ASSERT(bitstream != NULL); ASSERT(bit_count <= 16); - ASSERT(bitstream->current_byte_index + - (bitstream->current_bit_offset + bit_count) % 8 <= + ASSERT((bitstream->current_bit_offset + (size_t)bit_count) / 8 <= bitstream->data_size); int bit_to_read = bit_count; |
