Repository navigation
Conversation
|
Hi @mzfr! 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! |
What and why
ZSTD_compressCCtx(),ZSTD_compress_usingDict(), andZSTD_compress_usingCDict()install the one-shot input size as the current frame pledge, but leave that pledge in the context after successful compression. Reusing the same context for a differently sized streaming job can therefore fail withZSTD_error_srcSize_wrongbefore consuming input.Route the shared simple one-shot completion paths through a helper that resets the session after a successful frame. The session-only reset clears frame-local streaming state, including the pledged source size, while keeping requested parameters and referenced dictionaries. Failed one-shot operations retain the existing error-state behavior, and the public bufferless
ZSTD_compressBegin()/ZSTD_compressContinue()/ZSTD_compressEnd()API is unchanged.The regression test covers all three public simple one-shot variants with an empty one-shot followed by a 12-byte
ZSTD_e_continuestreaming job. It also compares the resulting frame with a reference context to verify that sticky parameters and a referenced CDict survive the new session boundary.Checklist
A gain in one configuration is not a general gain: see the Performance section of CONTRIBUTING.md.
Tests
24-cctx,24-usingdict,24-cdict,24-compress2-control,24-reset-control, and24-same-size-controlmake -C tests test-fuzzer FUZZERTEST='-i0 -s1'make -C tests test-zstream ZSTREAM_TESTTIME='-T10s'make checkTools used
I used GPT-5.6-Sol for everything from finding the bug to fixing it, writing the patch, generating tests, and preparing the PR description.