Repository navigation
Add ZSTD_findFrameBoundaries() frame scanner API - #4795
ceedot-rock wants to merge 1 commit into
Conversation
|
Hi @ceedot-rock! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
New public helper that scans a buffer and reports every zstd frame's offset and compressed size without decompressing, enabling frame-granularity parallel decompression. Handles standard, skippable and legacy frames; strict all-or-nothing validation.
aa5ba95 to
79451c4
Compare
Closes #4734.
Adds a public helper that scans a buffer and reports every frame's offset and compressed size without decompressing. Returns the frame count on success; validates the whole buffer strictly (bad magic -> prefix_unknown, truncation -> srcSize_wrong). Passing NULL for the output array gives a count-only pass so callers can allocate, then fill.
Why: parallel decompression at frame granularity needs frame boundaries up front, and there was no single helper doing it. The scan delegates to ZSTD_findFrameCompressedSize, so standard, skippable, and legacy frames behave exactly the way the library already handles them.
Tests: new unit test (tests/frameScannerTest.c) - mixed standard/skippable buffers, truncation points, corrupted magic, garbage input - plus each reported frame independently decompresses to its original bytes. Also extended tests/fuzz/zstd_frame_info.c with scanner invariants (contiguity, bounds, count-vs-fill agreement). Existing fuzzer (2729 tests) and zstreamtest (1773 tests) pass; ~70k mutated inputs under ASan/UBSan clean.
Slid Phi Labs accepts donations to keep the lab independent.