15 Commits

Author SHA1 Message Date
Eric Biggers
57cab078f1 lib: optimize decompressing repeated static Huffman blocks
Improve libdeflate's worst-case performance decompressing malicious
DEFLATE streams by about 14x, bringing it within a factor of about 2x of
zlib, by skipping rebuilding the decode tables for the static Huffman
codes when they're already loaded into the decompressor.

This improves performance decompressing a stream of all empty static
Huffman blocks from about 0.36 MB/s to 175 MB/s, or the original
reproducer given on the Github issue from about 3.3 MB/s to 219 MB/s.
A regression test is added for these cases as well as the empty dynamic
Huffman blocks case to verify worst-case performance comparable to zlib.

Resolves https://github.com/ebiggers/libdeflate/issues/33
2018-12-23 12:03:00 -06:00
Eric Biggers
0c62e25464 tools/run_tests.sh: detect gcc without multilib support 2018-02-18 23:03:26 -08:00
Eric Biggers
5f3afad793 tools/run_tests.sh: run checksum benchmarks 2018-02-18 23:03:26 -08:00
Eric Biggers
2f4315c21c tools/run_tests.sh: more Android tests 2018-02-18 23:03:26 -08:00
Eric Biggers
65a119ddfd run_tests.sh: test for same output on big endian CPU 2017-05-29 18:25:07 -07:00
Eric Biggers
8067f44e8c run_tests.sh: portability improvements
Support running the run_tests.sh script on more types of systems.
2017-05-29 17:44:50 -07:00
Eric Biggers
27c13370cb run_tests.sh: run tests on arm64 2017-03-19 12:29:49 -07:00
Eric Biggers
f2f0df7274 deflate_compress: fix corruption with long literal run
When the block splitting algorithm was implemented, it became possible
for the compressor to use longer blocks, up to ~300KB.  Unfortunately it
was overlooked that this can allow literal runs > 65535 bytes, while in
one place the length of a literal run was still being stored in a u16.
To overflow the litrunlen and hit the bug the data would have had to
have far fewer matches than random data, which is possible but very
unusual.  Fix the bug by reserving more space to hold the litrunlen, and
add a test for it.
2017-01-14 20:51:03 -08:00
Eric Biggers
28cc14994b run_tests.sh: look for other clang versions 2016-11-04 21:27:50 -07:00
Eric Biggers
99d6e72b89 Add gzip program tests 2016-10-23 14:13:36 -07:00
Eric Biggers
7662390f55 run_tests.sh: fix Android device detection 2016-10-16 12:14:21 -07:00
Eric Biggers
14007c05fa run_tests.sh: improve reporting of Android test failures 2016-10-16 12:14:16 -07:00
Eric Biggers
0cd875d811 run_tests.sh: improve/fix test group handling 2016-10-16 12:13:02 -07:00
Eric Biggers
1190be5a68 run_tests.sh: include test programs in static analysis 2016-10-15 20:38:29 -07:00
Eric Biggers
146d91c03f Test script improvements 2016-10-15 18:57:36 -07:00