summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
Commit message (Collapse)AuthorAgeFilesLines
* fixed usan32 testsYann Collet2022-10-011-4/+4
| | | | | the sanitizer was not enabled, due to environment variables not being passed.
* fix another ubsan warning in lz4hcmd_offYann Collet2022-10-011-1/+1
| | | | | | | because ubsan complains even about intermediate pointer arithmetic results (in a simple linear formula with 3 factors for example). use parenthesis to make sure calculations go directly from one valid memory address to another valid memory address value.
* use LZ4HC_match_t structure directly to store match candidatesYann Collet2022-10-011-68/+53
| | | | | this formalized better the coupling between match length and match offset which were 2 separated variables before.
* removed virtual pointer from optimal parserYann Collet2022-09-301-5/+4
| | | | | replaced by direct offset value. this virtual pointer was only used in rare _dstSize scenario.
* removed virtual match pointer from HC parserYann Collet2022-09-301-26/+23
| | | | replaced by direct offset values.
* sequence encoder accepts offset as a valueYann Collet2022-09-301-14/+15
| | | | instead of a virtual pointer
* LZ4 HC matchfinder returns an offset valueYann Collet2022-09-301-43/+58
| | | | instead of a virtual past pointer.
* added code documentation on heap modeYann Collet2022-09-271-3/+4
| | | | and also on decompress_continue variants.
* fixed minor UB warningYann Collet2022-09-161-12/+13
| | | | now, even intermediate ptr arithmetic results can be UB ??
* fix benchmark more using DictionaryYann Collet2022-09-151-3/+10
| | | | | | | benchmark dictionary mode, implemented in #808, is incorrect. It would desynchronize compression and decompression as soon as 2+ files are dictionary compressed. Also : slightly improved traces system, to also include __LINE__ number
* fixed a few ubsan warnings in lz4hcYann Collet2022-09-091-18/+18
| | | | mostly related to pointer arithmetic involving NULL ptr.
* Fix: Disable LZ4HC correspond functions when ↵Takayuki Matsuoka2022-08-071-0/+2
| | | | LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION is enabled
* Merge pull request #1124 from t-mat/compile-time-purge-memalloc-funcYann Collet2022-08-051-0/+2
|\ | | | | Introduce LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION
| * Introduce LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATIONTakayuki Matsuoka2022-07-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset introduces new compile time switch macro LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION which removes the following functions when it's defined. ``` // lz4.c LZ4_createStream LZ4_freeStream LZ4_createStreamDecode LZ4_freeStreamDecode LZ4_create // legacy // lz4hc.c LZ4_createStreamHC(void) LZ4_freeStreamHC LZ4_createHC // legacy LZ4_freeHC // legacy ``` These functions uses dynamic memory allocation functions such as malloc() and free(). It'll be useful for freestanding environment which doesn't have these allocation functions. Since this change breaks API, this macro is only valid with lz4 as a static linked object.
* | New macro for memcpy, memmove and memsetTakayuki Matsuoka2022-07-311-4/+4
|/ | | | | | | | This changeset introduces the following external macros. - Add new macro LZ4_memset() which enables to inject external function as memset(). - Similar macro LZ4_memmove() for memmove(). - In same manner, LZ4_memcpy() also can be overriden by external macro.
* removed ->dictBase from lz4hc stateYann Collet2022-07-131-26/+33
| | | | replaced by ->dictStart
* removed ->base from lz4hc stateYann Collet2022-07-131-66/+67
| | | | replaced by ->prefixStart
* clarify static sizes of states for static allocationYann Collet2022-07-121-3/+1
|
* added target test-compile-with-lz4-memory-usageYann Collet2022-01-311-0/+2
| | | | and run it in GA CI
* fixed bug in optimal parserYann Collet2022-01-291-19/+17
| | | | discovered by @yoniko.
* Fix typos found by codespellDimitri Papadopoulos2021-11-251-2/+2
|
* fix LZ4HC_HEAPMODE macro guardTotalJustice2021-06-251-3/+3
|
* fix null pointer dereferenceklebertosantos2021-03-101-1/+3
|
* Don't trigger UBSan warning in LZ4_resetStreamHC_fast if ↵Simon Giesecke2021-01-071-1/+5
| | | | LZ4_streamHCPtr->internal_donotuse.end is NULL.
* updated license & header datesYann Collet2020-11-251-1/+1
|
* 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
|