25 Commits

Author SHA1 Message Date
Timofey Solomko d8c22c55da [Deflate][Huffman] Filter out zero code lengths only during code construction
This should prevent crashes described in issue #57.
2026-03-01 20:35:21 +08:00
Timofey Solomko 7e6a9fd42c [Deflate] Add a check for correct number of literal/length codes 2026-03-01 20:35:21 +08:00
Timofey Solomko a39011a00b [Deflate] Fix potential crashes in cases of too large copy amount
In a dynamic Huffman block if either previous or zero code length is copied too many times, it could cause a crash or lead to inconsistent state. These situations are checked now.
2026-03-01 20:35:21 +08:00
Timofey Solomko ccf97c995b [Deflate] Check that 16 is not the first code length symbol
This symbol in the dynamic Huffman block encodes copy of the previous code length. If this symbol is the first, then there is nothing to copy. Previously, this could cause a crash.
2026-02-28 01:26:43 +08:00
Timofey Solomko b743b0b7ed [Deflate] Optimize decoding of code lengths for dynamic trees 2026-02-26 00:53:17 +08:00
Timofey Solomko ce1736a2b0 [Huffman] Add HuffmanCodes typealias for clarity 2026-02-18 00:10:29 +08:00
Timofey Solomko ea9aaccfb9 Update copyright year to 2026 2026-01-31 15:30:24 +08:00
Timofey Solomko ed66991cbd Update copyright year to 2024 2024-01-11 16:57:04 +03:00
Timofey Solomko 43132fc39d Update copyright year to 2023 2023-02-07 15:31:45 +02:00
Timofey Solomko 78459b710a [Deflate] Fix incorrect truncation check when processing uncompressed blocks 2022-09-23 19:45:45 +03:00
Timofey Solomko 2b47fb7f49 [Deflate] Replace computation of static tree codes from lenghts with precomputed codes 2022-05-21 23:00:36 +03:00
Timofey Solomko e500dfc5d9 [Deflate] Add guards against truncated inputs 2022-05-20 21:46:57 +03:00
Timofey Solomko 79295db930 Update copyright year to 2022 2022-01-08 15:02:59 +03:00
Timofey Solomko e83f23effa Update copyright year to 2021 2021-01-11 11:20:57 +02:00
Timofey Solomko 31ec1f1553 Update copyright year to 2020 2020-01-01 19:06:33 +03:00
Timofey Solomko db82490ed8 Replace the usage of the deprecated Data(bytes:) initializer 2019-05-01 19:30:48 +03:00
Timofey Solomko 04f64bcb72 Rename Encoding/DecodingHuffmanTree to just Encoding/DecodingTree 2019-03-12 22:31:35 +03:00
Timofey Solomko 250c9fbd4c Remove old CodeLength initializer from Decoding(Huffman)Tree 2019-03-12 22:31:13 +03:00
Timofey Solomko ce47019097 Update copyright year to 2019 2019-01-02 23:15:43 +03:00
Timofey Solomko 44f33bf02a Make bit reader and writer functions' parameters concrete classes
Previously, it was almost always protocols, which in some cases didn't make sense.
2018-01-07 22:27:36 +03:00
Timofey Solomko e714dc308b Updated copyright year to 2018 2018-01-03 19:44:18 +03:00
Timofey Solomko c8d92e56d3 Replace BitReader and ByteReader with BitByteData's implementations 2018-01-03 19:22:15 +03:00
Timofey Solomko 545e5c69fc Remove some redundancy from documentation 2017-11-14 21:35:30 +03:00
Timofey Solomko feb41deed1 Return Data instead of UInt8 arrays in internal decompress functions 2017-11-11 12:54:31 +03:00
Timofey Solomko 843896edcf Move source code files into subfolders 2017-10-06 23:10:01 +03:00