Commit Graph

2349 Commits

Author SHA1 Message Date
Nick Terrell
b487660309 [lz4frame] Skip magic and checksums in fuzzing mode
When `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` is defined we skip
magic and checksum checks. This makes it easier to fuzz decompression.
2019-07-18 18:45:32 -07:00
Nick Terrell
1f236e0790 Fix LZ4_attach_dictionary with empty dictionary 2019-07-18 12:29:15 -07:00
Nick Terrell
675ef9a9fc [fuzz] Add HC fuzzers for round trip, compress, and streaming 2019-07-18 12:29:15 -07:00
Nick Terrell
399a80d48e [fuzzer] Update scripts for new fuzzers 2019-07-18 12:29:15 -07:00
Nick Terrell
9b258abd93 [fuzz] Add a streaming round trip fuzzer 2019-07-18 12:29:15 -07:00
Nick Terrell
7c32101c65 [LZ4_compress_destSize] Fix off-by-one error in fix
The next match is looking at the current ip, not the next ip,
so it needs to be cleared as well.

Credit to OSS-Fuzz
2019-07-18 12:20:29 -07:00
W. Felix Handte
40943ba0c9 Unconditionally Clear dictCtx 2019-07-18 13:35:12 -04:00
W. Felix Handte
369fb3900c Fix Data Corruption Bug when Streaming with an Attached Dict in HC Mode
This diff fixes an issue in which we failed to clear the `dictCtx` in HC
compression. The `dictCtx` is not supposed to be used when an `extDict` is
present: matches found in the `dictCtx` do not account for the presence of an
`extDict` segment, and their offsets are therefore miscalculated when one is
present. This can lead to data corruption.

This diff clears the `dictCtx` whenever setting an `extDict`.

This issue was uncovered by @terrelln's fuzzing work.
2019-07-18 12:48:41 -04:00
dooxe
99d925f997 Added BUNDLE DESTINATION in CMakeLists.txt so that it works with newer versions of cmake 2019-07-18 11:25:43 +02:00
Yann Collet
19b099986a
Merge pull request #756 from terrelln/destSize
[LZ4_compress_destSize + multi-blocks streaming] Fix rare data corruption bug
2019-07-17 13:25:41 -07:00
Nick Terrell
13a2d9e34f [LZ4_compress_destSize] Fix overflow condition 2019-07-17 11:50:47 -07:00
Nick Terrell
6bc6f836a1 [LZ4_compress_destSize] Fix rare data corruption bug 2019-07-17 11:38:38 -07:00
Nick Terrell
690009e2c2 [LZ4_compress_destSize] Allow 2 more bytes of match length 2019-07-17 11:07:24 -07:00
Yann Collet
7654a5a6d2
Merge pull request #752 from terrelln/fuzzers
[ossfuzz] Improve the fuzzers
2019-07-16 11:18:09 -07:00
Yann Collet
81a14ccccb
Merge pull request #755 from lz4/custom_distance
ensure conformance with custom LZ4_DISTANCE_MAX
2019-07-15 16:38:28 -07:00
Nick Terrell
3c40db8d25 [ossfuzz] Improve the fuzzers
* Run more decompression variants
* Round trip the compression fuzzer and do partial decompression as well
* Add a compression fuzzer that compresses into a smaller output buffer
  and test the destSize variant

These fuzzers caught 2 bugs that were fixed in the previous commit.
* Input buffer over-read in partial decompress
* Partial decompress fails if output size is 0
2019-07-15 12:22:04 -07:00
Nick Terrell
725cb0aafd [lz4] Fix bugs in partial decoding
* Partial decoding could read a few bytes beyond the end of the input
* Partial decoding returned an error with an empty output buffer
2019-07-15 12:21:59 -07:00
Yann Collet
6654c2cd3b ensure conformance with custom LZ4_DISTANCE_MAX
It's now possible to select a custom LZ4_DISTANCE_MAX at compile time,
provided it's <= 65535.

However, in some cases (when compressing in byU16 mode),
the new distance wasn't respected,
as it used to implied that it was necessarily within range.

Added a distance check for this case.
Also : added a new TravisCI test which ensures that
custom LZ4_DISTANCE_MAX compiles correctly
and compresses correctly (relying on `assert()` to find outsized offsets).
2019-07-15 12:11:34 -07:00
Yann Collet
a23541463d
Merge pull request #753 from Hitatm/fix_LZ4_DISTANCE_MAX
bugfix: correctly control the offset < LZ4_DISTANCE_MAX,when change t…
2019-07-15 09:08:11 -07:00
Hitatm
8ac954aa71 bugfix: correctly control the offset < LZ4_DISTANCE_MAX,when change the value of LZ4_DISTANCE_MAX, 2019-07-15 22:53:46 +08:00
Yann Collet
f1e8e806e0 keep the "lorem ipsum" topic of the example string
but make it compressible
2019-07-11 17:29:16 -07:00
Yann Collet
23bd36918e
Merge pull request #751 from hamidzr/simple-buffer-example-input
simple buffer example minor input update. fixes #750
2019-07-11 17:26:15 -07:00
Hamid Zare
771a7192d6 print the compression ratio 2019-07-11 14:39:29 -07:00
Hamid Zare
658ab8fca1 changed the input text to something more compression friendly 2019-07-11 14:35:51 -07:00
Yann Collet
eb6b599a50
Merge pull request #749 from sylvestre/patch-1
Remove an useless declaration
2019-07-04 13:03:08 -07:00
Sylvestre Ledru
12e5841e76
Remove an useless declaration 2019-07-04 18:13:36 +02:00
Yann Collet
68d045e0b2
Merge pull request #746 from lz4/circleci
CircleCI : reduced test duration
2019-07-03 16:16:52 -07:00
Yann Collet
3d68e32b73
Merge pull request #743 from lz4/fuzzasan_fixed
updated frametest
2019-07-03 16:16:19 -07:00
Yann Collet
fb52a10ced
Merge pull request #748 from amchoukir/amchoukir-doublebuffer-doc
Update blockStreaming_doubleBuffer.md
2019-07-03 16:13:44 -07:00
Amine Choukir
0e6ff83d09
Update blockStreaming_doubleBuffer.md 2019-07-03 11:50:38 +02:00
Yann Collet
4765da5ac4
Merge pull request #745 from lz4/bump_192
bumped version number to v1.9.2
2019-07-01 11:52:08 -07:00
Yann Collet
9ea2835eaa CircleCI : reduced test duration
Ideally, we want to make CircleCI a "fast" test environment, with short feedback loop (~5mn).
We are still far from this goal.

This patch starts this process by removing "long" tasks which are non-essential and redundant with travisCI.

It also acknowledges that parallelism is broken.
The script should be more heavily updated to support parallelism,
which might be important to support its goal.
2019-07-01 10:55:54 -07:00
Yann Collet
bb5c34a875 bumped version number to v1.9.2
to reduce risks that future bug reports in `dev` branch report `v1.9.1` as the failing version.
2019-07-01 09:01:43 -07:00
Yann Collet
2cacdd2142 fix minor cppcheck warnings 2019-06-30 15:36:32 -07:00
Yann Collet
89e96e55ff updated frametest
so that noisy src decompression
doesn't generate output
nor fails when decompression fails (which is expected).
2019-06-30 14:57:12 -07:00
Yann Collet
81dba1946e Merge branch 'fuzzasan' into fuzzasan_fixed 2019-06-30 14:01:08 -07:00
Yann Collet
4e87942529 frametest: added LZ4F decoder noise test 2019-06-30 13:59:49 -07:00
Yann Collet
9dc5981368
Merge pull request #739 from cmeister2/cmeister2/ossfuzz
oss-fuzz: Add a fuzzing target that compiles in the oss-fuzz environment
2019-06-30 13:05:15 -07:00
Max Dymond
f3ec519f59
Remove unnecessary call to Makefile.inc 2019-06-30 20:16:03 +01:00
Yann Collet
40bd6164bb
Merge pull request #741 from lzutao/meson-deprecated-warn
meson: Fix deprecated warnings on build options
2019-06-30 11:33:38 -07:00
Yann Collet
bccbdb47be
Merge pull request #742 from lz4/fuzzasan_fixed
New fuzzer test for #738
2019-06-30 09:41:56 -07:00
Lzu Tao
84f98dd316 meson: Rename options in travis config 2019-06-29 20:54:39 +07:00
Yann Collet
1ccca52f53 Merge branch 'dev' into fuzzasan_fixed 2019-06-28 21:03:07 -07:00
Yann Collet
3b917ef6e6 travisCI: added ASAN fuzzer tests
and fixed minor formatting warnings
2019-06-28 20:55:47 -07:00
Yann Collet
567b4e098b moved noisy-src decoder test into cBuffer_exact
so that it can also catch any potential read out-of-bound in the input buffer
(none reported so far, just a precaution for the future).
2019-06-28 20:23:12 -07:00
Yann Collet
62f59d562b fuzzer: added test to catch #738 2019-06-28 20:15:43 -07:00
Lzu Tao
ff27a1572b meson: Always build gen_manual on build machine
As gen_manual is using as a generator, not a binary target
installed on host machine.
2019-06-29 10:11:32 +07:00
Lzu Tao
4c60f25c65 meson: Fix deprecated warnings on build options
Meson now reserves `build_` prefix options.
2019-06-29 10:10:05 +07:00
Yann Collet
8b97fcda60
Merge pull request #740 from terrelln/fix2
Fix out-of-bounds read
2019-06-28 19:22:54 -07:00
Max Dymond
e2a33f12e1
More markups for style changes 2019-06-29 00:23:06 +01:00