Commit Graph

108 Commits

Author SHA1 Message Date
Yann Collet
c76564b944 attempt at silencing cppcheck 2020-11-08 19:48:47 -08:00
Yann Collet
b16b9fcdbc added similar tests for LZ4_saveDict()
fast (non-HC) variant
2020-11-07 18:24:02 -08:00
Yann Collet
a2222a879f fix #926
fix incorrect behavior of LZ4_saveDictHC()
when invoked right after initialization.
2020-11-07 18:12:26 -08:00
Yann Collet
e968a24129 unified alignment test
across lz4.c and lz4hc.c
2020-11-06 14:46:48 -08:00
Yann Collet
ad552101dd fix minor explicit cast 2020-10-31 01:55:04 -07:00
Yann Collet
4b97866333 reduce new test stack usage
use heap instead
2020-10-02 18:03:12 -07:00
Yann Collet
58c0a549ad fix cppcheck unused variable warning 2020-10-02 14:10:00 -07:00
Yann Collet
de52a52518 added LZ4_streamHC_t init test
which includes an alignment test
2020-10-02 13:23:11 -07:00
Yann Collet
78f4fdbb89
Merge pull request #923 from lz4/fix784
fix efficiency of LZ4_compress_HC_destSize()
2020-09-28 14:04:56 -07:00
Yann Collet
89736e4e27 ensure last match not too close to end
must respect MFLIMIT distance from oend
2020-09-27 23:59:56 -07:00
Yann Collet
a13c79d56d fix incorrect counting
after truncation of last sequence
2020-09-27 22:47:05 -07:00
Yann Collet
e7fe105ac6 fix efficiency of LZ4_compress_HC_destSize()
LZ4_compress_HC_destSize() had a tendency
to discard its last match when this match overflowed specified dstBuffer limit.
The impact is generally moderate,
but occasionally huge,
typically when this last match is very large
(such as compressing a bunch of zeroes).

Issue #784 fixed for both Chain and Opt implementations.

Added a unit test suggested by @remittor checking this topic.
2020-09-27 21:04:40 -07:00
Yann Collet
ee4f37d284 fix compressing into NULL
fails properly
bug discovered by oss-fuzz
2020-09-26 11:31:57 -07:00
Yann Collet
da1272979f fix #847
support NULL input
without triggering undefined sanitizer
2020-09-15 14:54:53 -07:00
Yann Collet
4f33a5935b added test triggering NULL arithmetic with usan
described in #847
2020-09-15 13:45:06 -07:00
Yann Collet
8b75d403d8 fixed minor pre-existing printf formatting
different signedness
2020-08-27 09:20:01 -07:00
Yann Collet
875308f31f fixed strict c90 support 2020-08-27 00:38:58 -07:00
Yann Collet
c5d6f8a8be fix #783
LZ4_decompress_safe_partial()
now also supports a scenario where
nb_bytes_to_generate is <= block_decompressed_size
And
nb_bytes_to_read is >= block_compressed_size.

Previously, the only supported scenario was
nb_bytes_to_read == block_compress_size.

Pay attention that,
if nb_bytes_to_read is > block_compressed_size,
then, necessarily, it requires that
nb_bytes_to_generate is <= block_decompress_size.
If both are larger, it will generate corrupted data.
2020-08-27 00:17:57 -07:00
Yann Collet
f9f3fdfb1c added test decompress-partial with extraneous input bytes
fails currently,
for investigation of #783
2020-08-12 14:39:01 -07:00
W. Felix Handte
9af86f0841 Remove dirty Field From LZ4_stream_t 2020-08-06 16:06:40 -04:00
Yann Collet
2cacdd2142 fix minor cppcheck warnings 2019-06-30 15:36:32 -07:00
Yann Collet
4e87942529 frametest: added LZ4F decoder noise test 2019-06-30 13:59:49 -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
Yann Collet
6c69ae6bd6 added test case for in-place decompression
worst case, designed to make the decoder overwrite into input
2019-05-30 16:17:47 -07:00
Yann Collet
b2ba857a4f fuzzer: changed internal buffer size
to ensure no overflow during unit tests
2019-05-29 13:33:55 -07:00
Yann Collet
45eba5b030 one more conversion warning 2019-05-29 13:17:45 -07:00
Yann Collet
76116495bf some more minor conversion warnings fixes 2019-05-29 13:14:52 -07:00
Yann Collet
c5bcb4d68b fixed minor conversion warning 2019-05-29 12:56:27 -07:00
Yann Collet
b17f578a91 added comments and macros for in-place (de)compression 2019-05-29 12:06:13 -07:00
Yann Collet
4fc6b48550 added test case for in-place compression 2019-05-29 11:19:10 -07:00
Yann Collet
ae199124e5 fixed read-after input in LZ4_decompress_safe() 2019-04-18 18:50:51 -07:00
Yann Collet
4790994568 fuzzer : reduced stack usage 2019-04-18 17:12:14 -07:00
Yann Collet
6cb084ed36 fuzzer: reduce stack usage to please Visual static analyzer 2019-04-18 17:01:36 -07:00
Yann Collet
0b876db6d4 address a few minor Visual warnings
and created target cxx17build
2019-04-18 16:07:16 -07:00
Yann Collet
4f6de46f60 fix several minor static analyzer warnings 2019-04-18 12:05:50 -07:00
Yann Collet
3f558163ad fuzzer: fixed scan-build leak warning
the program exit(),
so there is no need to track and dealloc every buffer.
2019-04-18 10:38:51 -07:00
Yann Collet
8f0e744063 fuzzer: fix explicit cast for C++ 2019-04-17 15:44:14 -07:00
Yann Collet
1ed69691a1 fuzzer: added tests to detect LZ4_decompress_fast() out of bound read 2019-04-17 13:31:24 -07:00
Norm Green
1848ea5cbd Fix AIX errors/warnings 2019-04-17 09:20:09 -07:00
Yann Collet
ce0f316989 fix fuzzer tests on dirty context
context is no longer dirty after a failed compressed block.
Actually, all indexes are fine.
It remains compatible with continued streaming, and reset*_fast().
2019-04-15 11:12:54 -07:00
Yann Collet
63bfb64b80 and even more visual conversion warnings 2019-04-12 17:40:23 -07:00
Yann Collet
d8d5f14138 fixed loadDictHC
by making a full initialization
instead of a fast reset.
2019-04-09 15:37:59 -07:00
Yann Collet
14c71dfa9c modified LZ4_initStreamHC() to look like LZ4_initStream()
it is now a pure initializer, for statically allocated states.
It can initialize any memory area, and because of this, requires size.
2019-04-09 13:55:42 -07:00
Yann Collet
2ece0d8380 created LZ4_initStream()
- promoted LZ4_resetStream_fast() to stable
- moved LZ4_resetStream() into deprecate, but without triggering a compiler warning
- update all sources to no longer rely on LZ4_resetStream()

note : LZ4_initStream() proposal is slightly different :
it's able to initialize any buffer, provided that it's large enough.
To this end, it accepts a void*, and returns an LZ4_stream_t*.
2019-04-05 12:56:26 -07:00
Yann Collet
2a94faf462 fixed _GNU_SOURCE duplicate 2019-04-05 11:55:34 -07:00
Yann Collet
a4f1635b0a fuzzer: fixed strict c99 with mmap+MAP_ANONYMOUS 2019-04-05 11:47:06 -07:00
Yann Collet
c491df54ec created LZ4_initStreamHC()
- promoted LZ4_resetStreamHC_fast() to stable
- moved LZ4_resetStreamHC() to deprecated (but do not generate a warning yet)
- Updated doc, to highlight difference between init and reset
- switched all invocations of LZ4_resetStreamHC() onto LZ4_initStreamHC()
- misc: ensure `make all` also builds /tests
2019-04-04 17:05:11 -07:00
Yann Collet
7a39fb8fb6 make _fast*() decoder generate a deprecation warning
updated modification
2019-04-04 12:47:36 -07:00