summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
Commit message (Collapse)AuthorAgeFilesLines
* fix minor win32 warningYann Collet2020-11-151-1/+2
|
* Merge branch 'dev' into customMemYann Collet2020-11-091-2/+5
|\
| * fixed remaining ubsan warningsYann Collet2020-11-091-2/+5
| |
* | first proposal for LZ4_USER_MEMORY_FUNCTIONSYann Collet2020-11-091-8/+7
|/ | | | | | | | | makes it possible to replace at link time malloc, calloc and free by user-provided functions which must be named LZ4_malloc(), LZ4_calloc() and LZ4_free(). answer #937
* fix minor UBsYann Collet2020-11-081-2/+2
| | | | | - check alignment before casting a pointer - saveDict : don't memmove() on NULL dst
* fix #926Yann Collet2020-11-081-18/+20
| | | | | fix incorrect behavior of LZ4_saveDictHC() when invoked right after initialization.
* Merge pull request #941 from lz4/revertinlineYann Collet2020-11-081-2/+2
|\ | | | | Revert "Replace "static" to "LZ4_FORCE_INLINE" for small functions"
| * Revert "Replace "static" to "LZ4_FORCE_INLINE" for small functions"Yann Collet2020-11-071-2/+2
| | | | | | | | This reverts commit 0e3933edd435c54cc2e21e38f5d4ba7bf644a24e.
* | fix #935Yann Collet2020-11-071-1/+1
|/ | | | | | | minor: identical declaration and prototypes of `LZ4HC_compress_optimal()` also : very minor optimization of `LZ4_memcpy_using_offset()`
* Merge pull request #936 from lz4/alignTestYann Collet2020-11-071-22/+13
|\ | | | | More alignment tests
| * unified alignment testYann Collet2020-11-061-18/+6
| | | | | | | | across lz4.c and lz4hc.c
| * preserver alignment test on Visual Studio x64Yann Collet2020-10-021-16/+19
| | | | | | | | | | this it works fine in this environment (only x86 is suspicious)
* | Merge pull request #930 from remittor-pr/fix_msvcYann Collet2020-10-311-2/+2
|\ \ | | | | | | Fix: The "inline" specifier do not use for LZ4_wildCopy8 and LZ4_wildCopy32
| * | Replace "static" to "LZ4_FORCE_INLINE" for small functionsremittor2020-10-071-2/+2
| |/ | | | | | | The "static" specifier does not guarantee that the function will be inlined.
* | [lz4hc] Made function LZ4HC_encodeSequence a human readableremittor2020-10-031-23/+30
|/
* fix bad init scenarioYann Collet2020-10-011-3/+5
|
* fix minor static analyzer warningsYann Collet2020-09-301-10/+9
| | | | | detected by scan-build, cppcheck and advanved compilation flags fix #786
* ensure last match not too close to endYann Collet2020-09-281-15/+29
| | | | must respect MFLIMIT distance from oend
* fix incorrect countingYann Collet2020-09-281-2/+3
| | | | after truncation of last sequence
* fix efficiency of LZ4_compress_HC_destSize()Yann Collet2020-09-281-24/+66
| | | | | | | | | | | | | 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.
* Reducing stack usage in _t_alignment checksAleksandr Kukuev2020-05-111-2/+2
|
* fix malloc handlingYan Pashkovsky2020-02-031-1/+4
|
* fix: allocate LZ4HC_optimal_t opt on heap each time (#837)Yan Pashkovsky2020-01-311-3/+16
|
* fixed lz4hc assert errorYann Collet2019-12-031-3/+3
| | | | | | | | | | | | | when src ptr is in very low memory area (< 64K), the virtual reference to data in dictionary might end up in a very high memory address. Since it's not a "real" memory address, just a virtual one, to calculate distance, it doesn't matter : only distance matters. The assert was to restrictive. Fixed.
* [lz4hc] Chain swap with accelerationNick Terrell2019-07-311-4/+10
|
* [lz4hc] Only allow chain swapping forwardsNick Terrell2019-07-311-1/+1
| | | | | | When the match is very long and found quickly, we can do matchLength * nbCompares iterations through the chain swapping, which can really slow down compression.
* [lz4hc] Fix pattern detection end of dictionaryNick Terrell2019-07-311-20/+45
| | | | | | The pattern detection in extDict mode could put `matchIndex` within the last 3 bytes of the dictionary. This would cause a read out of bounds.
* [lz4hc] Fix minor pessimization in extDict pattern matchingNick Terrell2019-07-311-1/+1
| | | | | | We should be comparing `matchPtr` not `ip`. This bug just means that this branch was not taken, so we might miss some of the forward length.
* [lz4hc] Improve pattern detection in ext dictNick Terrell2019-07-311-5/+13
| | | | | | | | | | | | It is important to continue to look backwards if the current pattern reaches `lowPrefixPtr`. If the pattern detection doesn't go all the way to the beginning of the pattern, or the end of the pattern it slows down the search instead of speeding it up. The slow unit in `round_trip_stream_fuzzer` used to take 12 seconds to run with -O3, now it takes 0.2 seconds. Credit to OSS-Fuzz
* [LZ4HC] Speed up pattern compression with external dictionaryNick Terrell2019-07-241-27/+47
| | | | Fixes #761.
* Unconditionally Clear `dictCtx`W. Felix Handte2019-07-181-5/+3
|
* Fix Data Corruption Bug when Streaming with an Attached Dict in HC ModeW. Felix Handte2019-07-181-0/+5
| | | | | | | | | | | | 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.
* bugfix: correctly control the offset < LZ4_DISTANCE_MAX,when change the ↵Hitatm2019-07-151-1/+1
| | | | value of LZ4_DISTANCE_MAX,
* fixed read-after input in LZ4_decompress_safe()Yann Collet2019-04-191-1/+1
|
* address a few minor Visual warningsYann Collet2019-04-181-0/+1
| | | | and created target cxx17build
* ensure consistent definition and usage of FREEMEMYann Collet2019-04-161-2/+2
| | | | as suggested by @sloutsky in #671
* unified limitedOutput_directiveYann Collet2019-04-151-19/+12
| | | | | | | | | | | between lz4.c and lz4hc.c . was left in a strange state after the "amalgamation" patch. Now only 3 directives remain, same name across both implementations, single definition place. Might allow some light simplification due to reduced nb of states possible.
* fix minor visual warningYann Collet2019-04-121-2/+2
| | | | | | yet some overly cautious overflow risk flag, while it's actually impossible, due to previous test just one line above. Changing the cast position, just to be please the thing.
* introduce LZ4_DISTANCE_MAX build macroYann Collet2019-04-111-8/+8
| | | | | | | | | | make it possible to generate LZ4-compressed block with a controlled maximum offset (necessarily <= 65535). This could be useful for compatibility with decoders using a very limited memory budget (<64 KB). Answer #154
* fixed loadDictHCYann Collet2019-04-091-10/+18
| | | | | by making a full initialization instead of a fast reset.
* modified LZ4_initStreamHC() to look like LZ4_initStream()Yann Collet2019-04-091-36/+73
| | | | | it is now a pure initializer, for statically allocated states. It can initialize any memory area, and because of this, requires size.
* fixed strict iso C90Yann Collet2019-04-051-1/+1
|
* created LZ4_initStreamHC()Yann Collet2019-04-051-60/+72
| | | | | | | | - 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
* Make fact that certain variables that are passed into LZ4HC_encodeSequence ↵Tim Zakian2019-01-091-7/+9
| | | | are changed by the function call
* lz4hc.c: change (length >> 8) to (length / 255)qiuyangs2019-01-061-2/+2
| | | Every 0xff byte in the compressed block corresponds to a length of 255 (not 256) in the input data. For long repeating sequences, using (length >> 8) may generate bad compressed blocks.
* Enable amalgamation of lz4hc.c and lz4.cBing Xu2018-11-161-14/+15
|
* Adding information about dirty context for _HC_ family of functionsOleg Khabinov2018-10-101-12/+23
|
* fixed minor cppcheck warnings in libYann Collet2018-09-181-2/+1
|
* avoid final trailing comma for enum listsYann Collet2018-09-131-1/+1
| | | | | | | as detected in #485 by @JoachimSchneider. Refactored the c_standards tests so that these issues get automatically detected in CI tests.
* removed one assert() conditionYann Collet2018-09-051-2/+1
| | | | which is not correct when using LZ4_HC with dictionary and starting from a low address (<0x10000).