Skip to content

Add a regression test for trailing skippable frames - #173

Open
methakon wants to merge 1 commit into
DataDog:1.xfrom
methakon:test/129-trailing-skippable-frame
Open

methakon wants to merge 1 commit into
DataDog:1.xfrom
methakon:test/129-trailing-skippable-frame

Conversation

@methakon

@methakon methakon commented Oct 6, 2026

Copy link
Copy Markdown

Refs #129

Why a test and no fix

The bug is real but already fixed on 1.x by "Keep decompressing as long as we have compressed data" (#155): that change made the streaming fallback keep consuming input after the first frame, so a trailing skippable frame no longer reads as truncated input. #129 was never closed, and nothing on 1.x covers the trailing-skippable shape — the two tests #155 added cover concatenated streams and truncated input, not this case.

What the test pins down

TestDecompressTrailingSkippableFrame covers the one-shot Decompress path with the exact shape from #129: a highly compressible 1,000,001-byte payload (so the compressed input is tiny and the streaming fallback runs), followed by a 12-byte skippable frame. That test fails with unexpected EOF on the parent of #155 and passes on current 1.x.

TestReaderTrailingSkippableFrame covers the same through the streaming reader with random data.

Verified before opening:

at #155~1:  TestDecompressTrailingSkippableFrame  FAIL  "unexpected EOF"
            TestReaderTrailingSkippableFrame      PASS
on 1.x:     both PASS
go test .   full suite ok

The go vet unsafe.Pointer warnings in zstd_stream.go and the gofmt flag on zstd_stream_test.go are pre-existing and untouched by this change.

If maintainers would rather #129 simply be closed as fixed by #155, that's fine too — happy to close this if so.

A valid zstd stream followed by a trailing skippable frame used to fail
one-shot Decompress with "unexpected EOF": the streaming fallback stopped
after the first frame and treated the skippable frame as truncated input.
The behaviour changed in "Keep decompressing as long as we have compressed
data", but no test covers the trailing-skippable shape specifically, and
issue DataDog#129 remains open as a result.

The test uses a highly compressible payload, since a large compressed
input takes the direct path and never hits the fallback. It covers both
the one-shot Decompress path and the streaming reader.

Refs DataDog#129

Signed-off-by: Swarna Sekhar Dhar <bapay.9@gmail.com>
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