1
0
mirror of https://github.com/lz4/lz4.git synced 2026-10-24 01:48:57 +03:00
Commit Graph

105 Commits

Author SHA1 Message Date
Yann Collet
fe68cd55b6 doc: state match copy semantics in block format
The block format section did not say how the match copy is performed.
Overlapping matches (matchlength > offset) were only mentioned in the
"Safe decoding" implementation note, framed as a safety concern rather
than as part of the format definition, which confused readers
implementing a decoder for the first time.

State explicitly, right after matchlength decoding, that match bytes
are copied one at a time in increasing order, so matchlength may
exceed offset.

Fixes #1794
2026-10-13 22:56:01 -07:00
Mingye Wang
ef02dc63ef lz4_Frame_format.md: document kernel legacy last block
Since 2c484419ef, the Linux Kernel is able to discern the end of a legacy LZ4 frame by the presence of four 0 bytes, parsed as a B.CSize of 0 in the decoder. This is originally intended to make it mix well with grub initrd concatenation behavior (which uses a clause in the initramfs format about allowing arbitrary zero paddings), but I think it is a pretty good idea for any application limited to the legacy format in general.
2025-07-21 12:15:48 +08:00
W. Felix Handte
063d1a978a Add Test Validating Allocated Size Matches Reported Size
Adds additional record-keeping to track the live allocation size of a context
using a custom memory allocator.

This could be extended to more scenarios (e.g., streaming) if desired.
2025-06-02 11:06:59 -04:00
Yann Collet
e77b14f8ad update multiconf.make 2025-04-30 17:06:44 -07:00
Yann Collet
36df905aa6 update API and man page documentation for v1.10 2024-07-20 15:21:39 -07:00
Yann Collet
1f43e4d191 updated manuals 2023-12-29 14:04:10 -08:00
Yann Collet
d3ae8e0e85 fix numCores detection on Linux 2023-12-28 14:04:41 -08:00
Yann Collet
da5e8b7b0f lz4frame: new API: LZ4F_compressBegin_usingDict()
Note: effectively limited to using the dictionary once for now,
as opposed to once per block when blocks are independent
(no impact when blocks are linked: dictionary is supposed to be used once anyway)

Also :
- clarifies that default lz4frame block size is 64 KB
- refactor LZ4 Frame spec, dictionary paragraph
- updated manual
2023-12-28 13:47:08 -08:00
Yann Collet
a2e4da3ec3 updated code documentation
notably around migration advisese from deprecated function.

fix #1310.
2023-12-07 16:14:37 -08:00
Yann Collet
32bfb209d3 clarify Data Block in the Frame format documentation
as requested in #1156
2022-09-12 18:24:26 -07:00
Yann Collet
18b293d9fd updated documentation in anticipation for v1.9.4 release 2022-08-11 14:06:30 -07:00
Dominique Pelle
3347485307 fix: various typos 2022-07-31 17:47:00 +02:00
Yann Collet
6c8508323a updated LZ4 Block Format documentation
hopefully answering concerns expressed in #792
2022-07-31 14:38:45 +02:00
Yann Collet
7deae4bd22 minor : proper interface for LZ4F_getBlockSize()
and proper documentation.
Also : updated manual
2022-07-13 15:55:56 +02:00
Yann Collet
0b0e3330bc minor frame format clarification
no need to specify that a decoder can "ignore the checksum".
2022-07-10 15:25:43 -07:00
Alexander Mohr
0ac3c74de1 review: fix findings
* 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>
2022-07-05 21:14:34 +02:00
Alexander Mohr
42eb47d42f uncompressed-api: allow uncompressed_update only for independent blocks
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
2022-07-05 11:56:23 +02:00
Alexander Mohr
9a42a9db94 dict-size: make lz4 context const
change the context to const to make
clear that the context is not modified
2022-06-11 23:58:03 +02:00
Alexander Mohr
5c7382798e review: Fix review findings
This commit fixes the review findings

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
2022-06-10 06:37:57 +00:00
Alexander Mohr
62f6cef564 review: Fix review findings
This commit fixes the review findings

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
2022-06-10 06:00:38 +00:00
Alexander Mohr
4aeb5020c3 frame-api: add method to insert uncomressed data
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>
2022-06-09 17:08:01 +02:00
Yann Collet
ce8ee024b2 update library version to v1.9.4
to reduce confusion in traces between dev branch and latest v1.9.3 release.
2022-04-17 10:06:18 -07:00
Yann Collet
1da033e601 updated block format documentation
to specifically call attention to offset==0 scenario,
which is invalid, and could lead to some form of security issue
if incorrectly dealt with (ignored).
2022-02-01 23:59:40 -08:00
Frank Wessels
775758cbb1 Update lz4_Block_format.md
Mini typo
2021-10-24 20:15:39 -07:00
Yann Collet
e2009622dd Merge pull request #1022 from lz4/uname
make UNAME externally definable
2021-09-20 16:04:07 -07:00
a1346054
eb23590d13 fix spelling 2021-08-21 20:50:38 +00:00
Yann Collet
596c747211 make UNAME externally definable
on top of providing a central definition place, which eases maintenance,
it might also help for #1021.

Also : updated doc
2021-08-16 16:43:17 -07:00
Yann Collet
87a80acbe7 updated license & header dates 2020-11-25 14:45:14 -08:00
Yann Collet
0760724577 update doc 2020-11-15 01:31:09 -08:00
Yann Collet
be634559e3 update obsolete section documentation
and update manuals.
fix #712
2020-11-08 12:54:59 -08:00
Yann Collet
293713a4fa bump version number
to v1.9.3
2020-09-29 14:27:39 -07:00
Yann Collet
5ab7d22fa5 clarify endMark definition 2020-08-14 15:03:03 -07:00
Yann Collet
e9cfa49d0d Clarifies and fix EndMark
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.
2020-08-12 17:27:33 -07:00
Yann Collet
bb5c34a875 bumped version number to v1.9.2
to reduce risks that future bug reports in `dev` branch report `v1.9.1` as the failing version.
2019-07-01 09:01:43 -07:00
Yann Collet
1d759576b9 precise again that LZ4 decoder needs metadata
and that such metadata must be provided / sent / saved by the application.
2019-06-06 13:20:30 -07:00
Yann Collet
5997e139f5 added more details for in-place documentation 2019-05-31 11:56:59 -07:00
Yann Collet
2f9d1736fb updated API manual 2019-05-30 16:23:53 -07:00
Yann Collet
22adbb176a add more doc on in-place (de)compression 2019-05-30 09:45:21 -07:00
Yann Collet
b17f578a91 added comments and macros for in-place (de)compression 2019-05-29 12:06:13 -07:00
Yann Collet
7a4e3b1fac bumped version number
to v1.9.1
2019-04-19 11:59:49 -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
21ff1a839a updated doc to underline difference between block and frame
as this is a very frequent source of confusion for new users.
2019-04-12 11:27:44 -07:00
Yann Collet
bcb26565a7 improved documentation for LZ4 dictionary compression 2019-04-11 15:20:46 -07:00
Yann Collet
8d76c8a44a introduce LZ4_DISTANCE_MAX build macro
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
2019-04-11 14:15:33 -07:00
Yann Collet
013fee5665 updated block format with more details on MF_LIMIT
aka distance from end of block for the last match.
2019-04-11 13:55:35 -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
7a39fb8fb6 make _fast*() decoder generate a deprecation warning
updated modification
2019-04-04 12:47:36 -07:00
Yann Collet
50f01d881d fixed doc
and bumped version number fo v1.9.0
2019-04-03 14:27:21 -07:00
Yann Collet
25da6cc967 moved _destSize() into "stable API" status
as requested in #642
2019-04-03 14:18:00 -07:00