Skip to content

fix(zstd): validate frame content sizes - #9164

Merged
AdamGS merged 1 commit into
vortex-data:developfrom
lorenzhs:lorenz/zstd-allocation-bound
Aug 4, 2026
Merged

AdamGS merged 1 commit into
vortex-data:developfrom
lorenzhs:lorenz/zstd-allocation-bound

Conversation

@lorenzhs

@lorenzhs lorenzhs commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Fuzzing found that zstd (arrays + buffers) serialised output sizes were not validated against the declared uncompressed sizes in frame headers.

What changes are included in this PR?

Validate serialized zstd output sizes against frame headers before CPU allocation and host-backed GPU planning. Add regressions for zstd arrays and zstd buffers.

Note that as long as the size declared in the frame header matches what's declared in metadata, allocations are not bounded. But this is much harder to fix, since zstd can essentially decompress to ⌈compressed_len/3⌉ × 128 KiB which is ~42GiB per MiB of compressed data so not particularly useful as a bound.

What APIs are changed? Are there any user-facing changes?

Malformed files where output sizes declared in zstd frames don't match the header are now refused instead of allocating a buffer of file-controlled size.

Investigated and built with Codex.

Validate serialized zstd output sizes against frame headers before CPU allocation and host-backed GPU planning. Add regressions for zstd arrays and zstd buffers.

Tested with:
- cargo nextest run -p vortex-zstd --all-features
- cargo clippy -p vortex-zstd --all-targets --all-features -- -D warnings

Signed-off-by: Lorenz Hübschle <lorenz@firebolt.io>
@lorenzhs
lorenzhs requested review from AdamGS and myrrc August 4, 2026 09:31
@lorenzhs lorenzhs added the changelog/fix A bug fix label Aug 4, 2026

@AdamGS AdamGS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AdamGS
AdamGS merged commit 1291ace into vortex-data:develop Aug 4, 2026
84 of 85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants