fix: stream truncation detection, heap-segment guards, ZDICT layouts#1
Merged
Conversation
Mirror the vortex-java publish flow: - root pom: scm, plugin-version properties, and a `release` profile (source + javadoc jars, gpg sign, central-publishing-maven-plugin with autoPublish) - per-module <description> on every deployable artifact (Central requires name/description/url/license/scm/developer); benchmark + integration-tests already set maven.deploy.skip - .github/workflows/publish.yml: on a v* tag, build (checkout submodule + Zig), deploy -Prelease, then cut a GitHub release from CHANGELOG.md - CHANGELOG.md with the 0.1 notes Release: set repo secrets CENTRAL_USERNAME/PASSWORD, GPG_PRIVATE_KEY, GPG_PASSPHRASE; register io.github.dfa1 on central.sonatype.com; push tag v0.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ZstdInputStream silently returned clean EOF when the underlying stream ended mid-frame, losing data without error. Track zstd's outstanding-input hint from decompressStream and throw ZstdException on a non-zero hint at EOF. Empty input stays a clean EOF. Also reuse a single-byte scratch buffer in read()/write(int) instead of allocating new byte[1] per call (streams are already non-thread-safe). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…layouts Zero-copy MemorySegment APIs dereference the segment address in C, so a heap-backed segment crashed with a cryptic FFM linker error. Add an isNative() guard (Zstd.requireNative) at each zero-copy entry — compress /decompress on the contexts and stream, plus decompressedSize — failing fast with a clear message. Replace the hand-coded ZDICT_cover/fastCover param struct offsets in optimize() with named MemoryLayout structs; offsets and allocation size now derive from the layout instead of magic numbers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror vortex-java: release:prepare drops -SNAPSHOT, tags v<version> (pushChanges=false, autoVersionSubmodules), bumps to next snapshot. Pushing the v* tag triggers publish.yml -> deploy -Prelease to Maven Central. Document the flow in the release profile comment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Review-driven correctness + robustness fixes for the FFM bindings.
Correctness
ZstdInputStreamsilently returned a clean EOF when the underlying stream ended mid-frame, dropping data without error. It now tracks zstd's outstanding-input hint fromdecompressStreamand throwsZstdExceptionon a non-zero hint at EOF. Empty input stays a clean EOF.Robustness / UX
MemorySegmentto a zero-copy API previously crashed with a cryptic FFM linker error. AddedZstd.requireNative(isNative()check) at each entry — compress/decompress on both contexts, the compress stream, anddecompressedSize— failing fast with a clear message.Maintainability
MemoryLayout. Replaced the hand-codedZDICT_cover/fastCoverstruct offsets (the most fragile spot in the codebase) with namedMemoryLayoutstructs; offsets and allocation size now derive from the layout.Performance
read()/write(int)instead of allocatingnew byte[1]per call (streams are already non-thread-safe).Tests
decompressedSize.🤖 Generated with Claude Code