summaryrefslogtreecommitdiffstats
path: root/lib/lz4frame.c
Commit message (Collapse)AuthorAgeFilesLines
* can select validation of CRC during benchmarkYann Collet2022-07-291-4/+4
| | | | | on command line, using existing long command --no-frame-crc. Note : it's effectively more than that, since _all_ checksums are disabled.
* added ability to skip checksum calculation when decoding LZ4 FramesYann Collet2022-07-291-9/+15
|
* Merge pull request #1115 from lz4/lz4f_customMemYann Collet2022-07-161-77/+155
|\ | | | | Support for Custom Memory managers
| * implemented LZ4F_createCDict_advanced()Yann Collet2022-07-131-16/+29
| |
| * implemented LZ4F_createDecompressionContext_advanced()Yann Collet2022-07-131-14/+25
| |
| * Merge branch 'dev' into lz4f_customMemYann Collet2022-07-131-5/+5
| |\
| * | implemented first custom memory manager interfaceYann Collet2022-07-131-59/+113
| | | | | | | | | | | | | | | | | | | | | for compression context only for the time being, using LZ4F_createCompressionContext_advanced(). Added basic test in frametest.c
* | | support skippable frames within pipeYann Collet2022-07-151-2/+0
| |/ |/| | | | | | | | | | | fix #977 fseek() doesn't work for pipe, switch to "read and forget" mode in such case.
* | fix stricter enum type requirements for C++Yann Collet2022-07-131-4/+4
| |
* | minor : proper interface for LZ4F_getBlockSize()Yann Collet2022-07-131-1/+1
|/ | | | | and proper documentation. Also : updated manual
* minor refactor : simplify LZ4F_makeBlockYann Collet2022-07-111-27/+20
| | | | one less argument
* review: fix findingsAlexander Mohr2022-07-051-1/+1
| | | | | | | | | * replace assert with test for LZ4F_uncompressedUpdate * update documentation to incldue correct docstring * remove unecessary entry point * remove compress_linked_block_mode from fuzzing test Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
* uncompressed-api: allow uncompressed_update only for independent blocksAlexander Mohr2022-07-051-99/+73
| | | | Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
* lz4frame: correct start and size after flushAlexander Mohr2022-07-041-1/+4
| | | | | | | | | | | when the block mode changes a flush is executed, to prevent mixing compressed and uncompressed data. Prior to this commit dstStart, dstPtr, dstCapacity where not updated to include the offset from bytesWritten. For inputs > blockSize this meant the flushed data was overwritten. Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
* meson: fix meson buildAlexander Mohr2022-06-111-1/+1
| | | | add static dependency to examples
* lz4frame: fix different linkage errorAlexander Mohr2022-06-111-1/+1
| | | | Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
* fuzz-test: add fuzz test for uncompressed apiAlexander Mohr2022-06-111-2/+1
| | | | | | add a fuzzing test for uncompressed frame api Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
* review: Fix review findingsAlexander Mohr2022-06-101-2/+5
| | | | | | This commit fixes the review findings Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
* frame-api: add method to insert uncomressed dataAlexander Mohr2022-06-091-62/+166
| | | | | | | | new method `uncompressed_update` allows to insert blocks without compression into the lz4 stream. The usage is documented in the frameCompress example Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
* introduced FORWARD_IF_ERROR()Yann Collet2022-05-101-48/+49
| | | | | | and removed prefix from RETURN_ERROR(_IF) to improve brevity as it's just a local macro (no bleeding in user's namespace).
* introduced macro LZ4F_RETURN_ERROR_IFYann Collet2022-05-071-32/+23
|
* introduced macro LZ4F_RETURN_ERRORYann Collet2022-05-071-37/+39
|
* removed ERROR_GENERIC from lz4frame.hYann Collet2022-05-071-3/+3
| | | | created a new error code in the process : LZ4F_ERROR_compressionState_uninitialized
* updated one error codeYann Collet2022-04-061-1/+1
|
* Introduce MIN and MAX bounds to LZ4_MEMORY_USAGEYann Collet2022-01-311-2/+2
| | | | | | | ensure that `frametest` works fine with these values, notably with low LZ4_MEMORY_USAGE (dict test notably) following suggestions from @t-mat at #1016
* Fix typos found by codespellDimitri Papadopoulos2021-11-251-1/+1
|
* Don't reuse state memory that's too small.Eddy Jansson2021-07-311-1/+13
| | | | | | | Ensure that the memory block we're trying to reuse is large enough for the new state. Fixes #974
* fix UB lz4:988 and lz4:1178Yann Collet2021-05-281-0/+2
| | | | | ensure `dictBase` is only used when there is an actual dictionary content.
* fix UB of lz4frame:907Yann Collet2021-05-281-56/+63
| | | | | | now line 912 by ensuring pointer arithmetic is only performed if there is a reason for an internal buffer to be used.
* minor : lz4frame include stdlib only if neededYann Collet2020-11-101-1/+1
|
* LZ4F_decompress requires a valid dctx stateYann Collet2020-11-071-0/+1
| | | | | This is now explicitly documented and asserted. fix #927
* add LZ4F_decompress() tests with (NULL,0) input and outputYann Collet2020-10-021-32/+52
| | | | fix one (rare & complex) issue discovered by this test
* make scan-build accept assert()Yann Collet2020-10-011-6/+9
|
* added memcpy() related SA warning fixesYann Collet2020-10-011-8/+14
| | | | memcpy() on NULL is UB, even if length is 0.
* fix minor static analyzer warningsYann Collet2020-09-301-10/+11
| | | | | detected by scan-build and cppcheck fix #786
* fixed lz4frame with blocks of size 1Yann Collet2020-09-171-1/+4
| | | | properly track history
* Clarifies and fix EndMarkYann Collet2020-08-131-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | EndMark, the 4-bytes value indicating the end of frame, must be `0x00000000`. Previously, it was just mentioned as a `0-size` block. But such definition could encompass uncompressed blocks of size 0, with a header of value `0x80000000`. But the intention was to also support uncompressed empty blocks. They could be used as a keep-alive signal. Note that compressed empty blocks are already supported, it's just that they have a size 1 instead of 0 (for the `0` token). Unfortunately, the decoder implementation was also wrong, and would also interpret a `0x80000000` block header as an endMark. This issue evaded detection so far simply because this situation never happens, as LZ4Frame always issues a clean 0x00000000 value as a endMark. It also does not flush empty blocks. This is fixed in this PR. The decoder can now deal with empty uncompressed blocks, and do not confuse them with EndMark. The specification is also clarified. Finally, FrameTest is updated to randomly insert empty blocks during fuzzing.
* fix LZ4F_compressBound when automatic flushing is enabledChristopher Harvie2020-05-141-0/+3
|
* [lz4frame] Fix unused variable warnings in fuzzing modeNick Terrell2019-07-191-0/+9
|
* [lz4frame] Skip magic and checksums in fuzzing modeNick Terrell2019-07-191-0/+12
| | | | | When `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` is defined we skip magic and checksum checks. This makes it easier to fuzz decompression.
* fix temporary buffer use when input size hint is respectedNiko Dzhus2019-05-241-1/+1
|
* Add multiframe report to --list commandgstedman2019-05-151-2/+2
|
* Include block checksum in worst case scenario calculation of dstCapacityBrenden Eng2019-04-261-0/+1
|
* lz4frame: initializers compatibility with C++Yann Collet2019-04-191-3/+5
| | | | fix #679, reported by @degski
* ensure consistent definition and usage of FREEMEMYann Collet2019-04-161-4/+4
| | | | as suggested by @sloutsky in #671
* Merge branch 'dev' of github.com:Cyan4973/lz4 into devYann Collet2019-04-131-12/+12
|\
| * fixed minor Visual warningsYann Collet2019-04-121-12/+12
| | | | | | | | | | | | | | | | since Visual 2017, worries about potential overflow, which are actually impossible. Replaced (c * a) by (c ? a : 0). Will likely replaced a * by a cmov. Probably harmless for performance.
* | fixed incorrect assertion conditionYann Collet2019-04-131-1/+1
|/ | | | output can use the full length of output buffer
* made LZ4F_getHeaderSize() publicYann Collet2019-04-101-42/+48
|
* modified LZ4_initStreamHC() to look like LZ4_initStream()Yann Collet2019-04-091-1/+2
| | | | | it is now a pure initializer, for statically allocated states. It can initialize any memory area, and because of this, requires size.