Commit Graph

187 Commits

Author SHA1 Message Date
Yann Collet
b87a8e9e62 fixed minor warning in fuzzer.c
added a few more comments and assert()
2018-09-10 16:48:41 -07:00
Yann Collet
d28389b2dc Merge branch 'dev' into partialDecode 2018-09-10 15:44:40 -07:00
Lucas Holt
3318d573ba Add support for MidnightBSD 2018-09-08 14:46:54 -04:00
Yann Collet
e22bb80074 fixed fuzzer test
and removed one blind copy, since there is no more guarantee that at least 4 bytes are still available in output buffer
2018-09-07 18:22:01 -07:00
Yann Collet
bf614d3c51 first sketch for a byte-accurate partial decoder 2018-09-07 15:44:19 -07:00
Yann Collet
0f08c22c31
Merge pull request #563 from lz4/docDict
updated documentation for dictionary compression
2018-09-06 12:43:29 -07:00
Yann Collet
0fea528e3a updated documentation regarding dictionary compression
following suggestion from @stbrumme (#558)

Also : bumped version number, regenerated man page and html doc
2018-09-05 14:05:08 -07:00
Yann Collet
30f6f34328 removed one assert() condition
which is not correct when using LZ4_HC with dictionary and starting from a low address (<0x10000).
2018-09-05 11:25:10 -07:00
Yann Collet
52cce30562 made roundTripTest fully general
no longer "locked" on level 9
2018-09-05 10:25:38 -07:00
Yann Collet
943fa6244a fix minor cast warning for C++ compilation 2018-09-04 17:45:51 -07:00
Yann Collet
d2d5660970 new test program : roundTripTest
make a round trip test with arbitrary input file,
generate an `abort()` on error,
to work in tandem with `afl`.

note : currently locked on level 9, to investigate #560.
2018-09-04 16:50:34 -07:00
Jennifer Liu
e778db373b Fixed bugs about incorrect acceleration calculation and benchmarking negative compresion level 2018-06-27 13:36:38 -07:00
Jennifer Liu
8745638d7c Fixed invalid argument test and reformatted else 2018-06-26 17:53:12 -07:00
Jennifer Liu
9ee5183d9b Fixed code based on comments from pull request 2018-06-26 17:31:15 -07:00
Jennifer Liu
e95706bb2a Fixed lz4 not found error part 2 2018-06-26 11:24:21 -07:00
Jennifer Liu
075952e340 Fixed lz4 not found error 2018-06-26 11:15:55 -07:00
Jennifer Liu
17bcb58eb0 Fixed bug about file to be compressed is not present 2018-06-25 18:51:47 -07:00
Jennifer Liu
536b79afd9 Added --fast command to cli 2018-06-25 17:46:39 -07:00
Norm Green
ebe7e35601 Fix AIX 32 bit build problem of fuzzer.c 2018-06-01 11:52:22 -07:00
W. Felix Handte
c746a27e91 Test Linking C-Compiled Library and C++-Compiled Tests 2018-05-21 22:29:20 -04:00
fbrosson
2149b1a8f6 Add Haiku as a validated target.
lz4 1.8.2 works fine on Haiku and passes all tests.
2018-05-17 16:52:53 +00:00
Yann Collet
abb1f70e17
Merge pull request #538 from lz4/frameTestError
Fix frametest error
2018-05-07 11:33:53 -07:00
Yann Collet
d7b6c726ed small extDict : fixed side-effect
don't fix dictionaries of size 0.
setting dictEnd == source triggers prefix mode,
thus removing possibility to use CDict.
2018-05-05 19:59:00 -07:00
Yann Collet
af12733467 fixed frametest error
The error can be reproduced using following command :
./frametest -v -i100000000 -s1659 -t31096808

It's actually a bug in the stream LZ4 API,
when starting a new stream
and providing a first chunk to complete with size < MINMATCH.
In which case, the chunk becomes a dictionary.
No hash was generated and stored,
but the chunk is accessible as default position 0 points to dictStart,
and position 0 is still within MAX_DISTANCE.
Then, next attempt to read 32-bits from position 0 fails.

The issue would have been mitigated by starting from index 64 KB,
effectively eliminating position 0 as too far away.

The proper fix is to eliminate such "dictionary" as too small.
Which is what this patch does.
2018-05-05 18:24:11 -07:00
Nick Terrell
3e7fa1b14d Attempt to fix travis 2018-05-04 14:33:59 -07:00
Nick Terrell
a7cc0b590a Fix make install
* Uninstall didn't remove the pkg-config correctly.
* Fix `mandir`
* Allow overriding either upper- or lower-case location variables, but
  always use the lower case variables.
* Add test case that ensures overriding both upper- and lower-case
  variables is the same, and that the directory is empty after uninstall.
2018-05-04 13:50:23 -07:00
Yann Collet
999a8488f6 removed test that might be optimized away
under UB rule "no overflow on int"
2018-05-02 13:57:33 -07:00
Yann Collet
93cf628a08 introduce LZ4_decoderRingBufferSize()
fuzzer : fix and robustify ring buffer tests
2018-05-02 13:01:04 -07:00
Cyan4973
5a2501a90d added a test case for LZ4_decompress_fast_usingDict
with a separated dictionary
since a joined dictionary is now detected as prefix64K.

Also : fixed a minor warning under msys
2018-04-29 07:42:24 -07:00
Yann Collet
9d4eae59f0
Merge pull request #522 from svpv/refactorDec
Refactor dec
2018-04-27 17:22:06 -07:00
Alexey Tourbin
ce4e1389cc fuzzer.c: enabled ring buffer tests for decompress_fast
Ring buffer tests were performed only with LZ4_decompress_safe_continue,
leaving my buggy changes to LZ4_decompress_safe_continue undetected.
The tests are now replicated and performed in a similar manner for both
LZ4_decompress_safe_continue and LZ4_decompress_safe_continue (except
for the small buffer case where only one function can be tested,
because part of the dictionary is overwritten with the output).

I also updated function names in the messages (changed them to the
actual ones).  The error was reported for LZ4_decompress_safe(),
which I found misleading.
2018-04-27 07:27:10 +03:00
W. Felix Handte
2becd69bb1 Add _destSize() to Fullbench 2018-04-26 17:25:12 -04:00
Alexey Tourbin
5603d30f81 lz4.c: fixed the LZ4_decompress_safe_continue case
The previous change broke decoding with a ring buffer.  That's because
I didn't realize that the "double dictionary mode" was possible, i.e.
that the decoding routine can look both at the first part of the
dictionary passed as prefix and the second part passed via dictStart+dictSize.

So this change introduces the LZ4_decompress_safe_doubleDict helper,
which handles this "double dictionary" situation.  (This is a bit of
a misnomer, there is only one dictionary, but I can't think of a better
name, and perhaps the designation is not all too bad.)  The helper is
used only once, in LZ4_decompress_safe_continue, it should be inlined
with LZ4_FORCE_O2_GCC_PPC64LE attached to LZ4_decompress_safe_continue.

(Also, in the helper functions, I change the dictStart parameter type
to "const void*", to avoid a cast when calling helpers.  In the helpers,
the upcast to "BYTE*" is still required, for compatibility with C++.)

So this fixes the case of LZ4_decompress_safe_continue, and I'm
surprised by the fact that the fuzzer is now happy and does not detect
a similar problem with LZ4_decompress_fast_continue.  So before fixing
LZ4_decompress_fast_continue, the next logical step is to enhance
the fuzzer.
2018-04-26 08:23:54 +03:00
W. Felix Handte
27c6eec18d Multiply-Include Header to Check Guard Macro Correctness 2018-04-24 18:50:03 -04:00
W. Felix Handte
2dfc7cbe82 Change Over Includes in the Project 2018-04-24 16:22:28 -04:00
Yann Collet
b2637ab7b2
Merge pull request #512 from lz4/HC_dict
In-place unmutable dictionaries for LZ4HC
2018-04-24 13:18:40 -07:00
W. Felix Handte
db9deb7b74 Remove the Framebench Tool 2018-04-24 11:58:51 -04:00
Cyan4973
bd06fde104 fullbench compiled without assert()
to better reflect release speed
2018-04-23 15:42:27 -07:00
Nick Terrell
672799e814 Fix compilation error and assert. 2018-04-23 14:21:02 -07:00
Nick Terrell
bb83cad98f Fix input size validation edge cases
The bug is a read up to 2 bytes past the end of the buffer.
There are three cases for this bug, one for each test case added.

* An empty input causes `token = *ip++` to read one byte too far.
* A one byte input with `(token >> ML_BITS) == RUN_MASK` causes
  one extra byte to be read without validation. This could be
  combined with the first bug to cause 2 extra bytes to be read.
* The case pointed out in issue #508, where `ip == iend` at the
  beginning of the loop after taking the shortcut.

Benchmarks show no regressions on clang or gcc-7 on both my mac
and devserver.

Fixes #508.
2018-04-23 13:34:18 -07:00
W. Felix Handte
209c9c29d1 Add Some Simple Fuzzer Tests 2018-04-20 15:16:41 -04:00
W. Felix Handte
e0d8add791 Fix Framebench Output Buffer Sizing 2018-04-19 20:45:48 -04:00
W. Felix Handte
9dae661b1f Fix Cast 2018-04-19 20:45:48 -04:00
W. Felix Handte
f646c512e9 Print Failure Message in Framebench 2018-04-19 20:45:48 -04:00
W. Felix Handte
9d971fd5c3 Switch to Unaligned Samples to Compress Different Blobs Each Time 2018-04-19 20:45:47 -04:00
W. Felix Handte
66f0c29aa4 Fix Framebench Statistics 2018-04-19 20:45:47 -04:00
W. Felix Handte
09df7a05f9 Add Run Name to Frame Bench Output 2018-04-19 20:45:47 -04:00
W. Felix Handte
a9a62321ff Auto-Calculate Appropriate Repetition Count 2018-04-19 20:45:47 -04:00
W. Felix Handte
d4ee7554fc Print More Detailed Results Inside bench(), Add Compression Levels 2018-04-19 20:45:47 -04:00
W. Felix Handte
ffb2d8b0ed Check Compressed Buffer is Correct in Frame Bench 2018-04-19 20:45:47 -04:00