Skip to content

An empty frame is an error, as it was before decode_frame - #200

Merged
torstei merged 1 commit into
mainfrom
bugfix/empty-frame-is-an-error
Oct 3, 2026
Merged

torstei merged 1 commit into
mainfrom
bugfix/empty-frame-is-an-error

Conversation

@torstei

@torstei torstei commented Oct 3, 2026

Copy link
Copy Markdown
Owner

A correction to #196 (released in 0.35.2).

decode_frame special-cased an empty input and returned an empty chunk. My description of that change said it was "as decode_all did". It was not: zstd::stream::decode_all(&[]) returns Err(incomplete frame), which I have now checked directly. I wrote that without testing it, and a test of my own helper found it.

The effect was small but real. An index record that says a chunk is zero bytes long is corrupt. Before #196 that was an error in every read path. After it, store.rs still caught it (it compares the length with the index), but query's read_chunk would return an empty chunk silently.

decode_frame now refuses an empty input again. Tests: the existing assertion is inverted, and a zero-length chunk record is followed through read_frame and decode_frame to the error.

🤖 Generated with Claude Code

decode_frame returned an empty chunk for an empty input. zstd's decode_all,
which it replaced, refuses one ("incomplete frame"), and an index record that
says a chunk is zero bytes long is corrupt: in the query path it would now show
as an empty chunk where it used to be an error.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@torstei
torstei merged commit 5fa9755 into main Oct 3, 2026
7 checks passed
@torstei
torstei deleted the bugfix/empty-frame-is-an-error branch October 3, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant