Commit Graph

34 Commits

Author SHA1 Message Date
Yann Collet
a4f1635b0a fuzzer: fixed strict c99 with mmap+MAP_ANONYMOUS 2019-04-05 11:47:06 -07:00
Tim Zakian
4ec29b0fab Fix C90 compatibility issue 2019-01-09 11:17:46 -08:00
Tim Zakian
8193742251 Make LZ4F_getBlockSize public and publis in experimental section 2019-01-09 10:49:49 -08:00
Lzu Tao
49073aca86 clang: Fix -Wcomma 2018-12-02 20:39:47 +07:00
Yann Collet
e07a37d712 added a test for LZ4F_compressEnd()
which actively tries to make it write out of bound.
For this scenario to be possible,
it's necessary to set dstCapacity < LZ4F_compressBound()

When a compression operation fails,
the CCtx context is left in an undefined state,
therefore compression cannot resume.
As a consequence :
- round trip tests must be aborted, since there is nothing valid to decompress
- most users avoid this situation, by ensuring that dstCapacity >= LZ4F_compressBound()

For these reasons, this use case was poorly tested up to now.
2018-10-09 14:25:18 -07:00
Yann Collet
b2215f2a89 tried to clean another bunch of cppcheck warnings
so "funny" thing with cppcheck
is that no 2 versions give the same list of warnings.

On Mac, I'm using v1.81, which had all warnings fixed.
On Travis CI, it's v1.61, and it complains about a dozen more/different things.
On Linux, it's v1.72, and it finds a completely different list of a half dozen warnings.

Some of these seems to be bugs/limitations in cppcheck itself.
The TravisCI version v1.61 seems unable to understand %zu correctly, and seems to assume it means %u.
2018-09-19 12:12:49 -07:00
Yann Collet
5a10ed2f7b added cppcheck
as Makefile target and Travis CI test.

Fixed last cppcheck warnings in tests and examples
2018-09-18 16:52:02 -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
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
W. Felix Handte
9dcd9abc14 Make LZ4F_compressFrame_usingCDict Take a Compression Context 2018-03-12 14:58:43 -04:00
W. Felix Handte
f34fb3c42d Add Bounds Check to locateBuffDiff 2018-03-12 14:58:43 -04:00
Yann Collet
77f99d2922 restored block checksum capability at lz4frame API level 2017-08-11 17:46:52 -07:00
Yann Collet
757497ae3d implemented lz4frame decompression API 2017-08-10 16:53:57 -07:00
Yann Collet
4531637ecd support dictionary compression with independent blocks 2017-08-10 12:12:53 -07:00
Yann Collet
d8aafe2c52 dictionary compression correctly uses compression level
Not obvious : copying the state was copying cdict's compression level
2017-08-10 00:48:19 -07:00
Yann Collet
31f2cdf4d2 implemented dictionary compression in lz4frame
note : only compression API is implemented and tested
still to do : decompression API
2017-08-09 16:51:19 -07:00
Yann Collet
a82dadfbae added dictID inside LZ4F_frameInfo_t
Compressor can set dictID on LZ4F_compressBegin()
Decompressor can retrieve it using LZ4F_getFrameInfo()
2017-08-08 17:43:11 -07:00
Yann Collet
2600a154be fix (minor) g++ compatibility for frametest 2017-05-10 17:06:31 -07:00
Yann Collet
e60cbb5cac added test for LZ4F_resetDecompressionContext() 2017-05-10 16:28:36 -07:00
Yann Collet
2012e4de9e fixed c_standards tests
and added entry "make list"
2017-05-10 14:51:09 -07:00
Yann Collet
e2c9b19122 lz4frame : Added negative compression levels 2017-04-09 01:41:36 -07:00
Yann Collet
fc31257ab2 added LZ4F_resetDecompressionContext() 2017-03-28 17:36:12 -07:00
Yann Collet
f0a7651fce Safer LZ4_getFrameInfo()
LZ4_getFrameInfo() is now guaranteed to keep dctx state clean,
even in case of failure.
2017-03-28 17:10:01 -07:00
Yann Collet
b41f9bb132 Merge pull request #292 from inikep/dev
improved POSIX
2016-12-22 11:58:29 +01:00
Przemyslaw Skibinski
973bc79740 util.h and platform.h based on zstd 2016-12-21 16:10:09 +01:00
Yann Collet
7cf0bb97b2 LZ4F_compressBound(0) provides upper bound for LZ4F_flush() and LZ4F_compressEnd() [#290, suggested by @vtermanis] 2016-12-21 14:18:01 +01:00
Przemyslaw Skibinski
64cbc4e1dc improved MinGW support 2016-12-21 10:22:40 +01:00
Przemyslaw Skibinski
9546ba62d0 executables use basic types from util.h 2016-12-21 09:44:59 +01:00
Yann Collet
1b24cc1155 fixed conversion warnings 2016-11-14 07:10:31 -08:00
Yann Collet
bf6dda69e6 updated frametest 2016-11-11 15:11:56 -08:00
Przemyslaw Skibinski
84cedb4632 updated links to LZ4 repository 2016-11-03 15:12:57 +01:00
Przemyslaw Skibinski
e624978ea2 test programs moved to tests/ 2016-11-03 15:03:43 +01:00