lz4-frame · shipping · also LZ4 framing

LZ4 frame

An LZ4 frame wraps data blocks in a descriptor and end marker, with optional length, dictionary identification and integrity checks.

Related Observatory article: Read on hesela.com

Frame completion, consumed input and output are separate. A complete first frame can leave input unread; a truncated end marker can follow all expected bytes. [2]

Moving independent blocks with their checksums can preserve block checks but fail the content checksum. Length cannot detect same-length reordering. [3]

In liblz4 1.9.4, Dict-ID is exposed, not enforced against supplied dictionary bytes. A matching ID can accompany wrong output with block checks alone. A later pointer does not rebind the dictionary; mutating retained bytes changes independent-block output. Keep it stable throughout decoding. [2] [4] [3]

Skippable and empty data frames both finish with zero output; frameType distinguishes them. Consuming all input does not prove inventory or bind skipped metadata. Completion resets dictionary binding; context reuse needs resupply for each dictionary-dependent frame. [2]

In liblz4 1.9.4, skipChecksums persists until completion. Controls skip content and stored-block checks but reject compressed-block and header checksum errors. Clearing it mid-frame cannot restore checks. A checksum flag alone is therefore not evidence of verification. [2] [4] [3]

LZ4F_headerSize sizes, not validates. Resume after LZ4F_getFrameInfo at its consumed count, not the sized header length. [2]

In liblz4 1.9.4, contentSize zero means unknown, not necessarily empty. Absent and explicitly zero fields decode nonempty controls; wrong nonzero sizes fail. The format permits skipping size validation. Check trusted expected length separately. [2] [1] [3]

Relations

related
Block-independent compression, Compression dictionary, Checksum, Skippable frame, Restore test, LZ77

Limitations

  • With checks enabled, liblz4 1.9.4 can return stored-block bytes before detecting their checksum error. Successful output is not yet a verified restore. [4, 3]

Citations

  1. LZ4 Frame Format 1.6.4, pinned to v1.10.0: block independence, checksums and dictionaries (accessed 2026-10-18)
  2. LZ4 v1.9.4 public frame API: preferences and LZ4F_decompress completion contract (accessed 2026-10-18)
  3. Hesela: LZ4 frame checks, block order and completion (accessed 2026-10-18)
  4. LZ4 v1.9.4 implementation: frame Dict-ID parsing and LZ4F_decompress_usingDict (accessed 2026-10-22)
Sources & caveats
  • The original 12 cases use no dictionary; a separate 18-case synthetic supplement supplies correct, wrong or missing dictionary bytes. Both use liblz4 1.9.4, not a measured corruption rate or security guarantee.
  • A separate 16-case two-block lifecycle supplement deliberately replaces an argument or mutates retained bytes. Allocations remain live; no use-after-free, concurrency, performance or field-rate result is claimed.
  • Ten synthetic multi-frame controls use the same dictionary across data frames; skipped metadata is outside the payload-only acceptance rule. No cross-dictionary switching or wrapper-wide behavior is inferred.
  • 24 checksum-field controls and two reused-context controls execute liblz4 1.9.4. Payload bytes remain unchanged. A v1.10.0 implementation comparison is source-only; no second-version reproduction or vulnerability claim.
  • A separate 32-case native streaming matrix changes input partitioning and output capacity. Stored-payload mutations can return all 8192 altered bytes before checksum failure; all mutated cases reject. Counts exclude error-returning calls; no second-version or performance result.
  • 24 bounded native size controls preserve identical block records and footers while changing the optional size field and descriptor checksum. Two buffer capacities and two block representations; no resource-exhaustion or second-version runtime test.

JSON: /data/terms/lz4-frame.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. LZ4 frame. Hesela. 2026-10-22. https://hesela.dev/terms/lz4-frame/