build: support decoding legacy zstd formats v0.4-v0.7#73
Merged
Conversation
Add -DZSTD_LEGACY_SUPPORT=4 and the four legacy decoders it pulls in
(zstd_v04.c-zstd_v07.c), matching what zstd-jni ships by default.
v0.1-v0.3 stay off — those predate zstd's 1.0 stabilization and are
essentially never seen in the wild.
Verified with real legacy-format data, not just "still links": the
vendored third_party/zstd/tests/legacy.c embeds a 917-byte fixture of
five concatenated frames (magic numbers 0xFD2FB524-0xFD2FB528 - v0.4
through v0.7 plus a current-format frame), each encoding the same
haiku text. Extracted it and round-tripped through a small harness
linked against the built library:
- built without this change: "Unknown frame descriptor" (fails, as
expected - this is the control)
- built with this change: decompresses all five frames correctly,
byte-for-byte matching the expected text
deprecated/ (the old ZBUFF_* streaming wrapper) stays excluded -
unrelated to legacy decoding, superseded by ZSTD_CCtx streaming.
All six classifiers cross-compile cleanly; local unit + integration
tests pass on osx-aarch64.
Ref #70
This was referenced Jul 17, 2026
dfa1
added a commit
that referenced
this pull request
Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Last unchecked item from #70's checklist:
DZSTD_LEGACY_SUPPORT=4 like zstd-jni.-DZSTD_LEGACY_SUPPORT=4plus the four legacy decoders it requires (zstd_v04.c-zstd_v07.c), matching zstd-jni's default. v0.1-v0.3 stay off — those predate zstd's 1.0 stabilization and are essentially never encountered in practice.deprecated/(the oldZBUFF_*streaming wrapper) stays excluded — unrelated to legacy decoding, superseded byZSTD_CCtxstreaming.Verified with real legacy-format data, not just "still links":
third_party/zstd/tests/legacy.c(vendored, part of zstd's own test suite) embeds a 917-byte fixture — five concatenated frames with magic numbers0xFD2FB524-0xFD2FB528(v0.4 through v0.7, plus a current-format frame), each encoding the same haiku text. I extracted it and round-tripped it through a small harness linked against the built library:ZSTD_decompressfails withUnknown frame descriptor(control case, confirms the fixture actually exercises legacy decoding)Test plan
./mvnw -q validate(checkstyle) clean./mvnw -q -pl zstd,integration-tests -am testpasses on osx-aarch64 (no regression to current-format decode)osx-aarch64,osx-x86_64,linux-x86_64,linux-aarch64,windows-x86_64,windows-aarch64) cross-compile cleanly🤖 Generated with Claude Code