Skip to content

fix: bound affinity entry decompression - #28

Merged
IAmJSD merged 1 commit into
Infrawrench:mainfrom
ProdigyRahul:fix/affinity-zstd-bound
Aug 25, 2026
Merged

fix: bound affinity entry decompression#28
IAmJSD merged 1 commit into
Infrawrench:mainfrom
ProdigyRahul:fix/affinity-zstd-bound

Conversation

@ProdigyRahul

Copy link
Copy Markdown
Contributor

fixes #27

reject an entry whose declared size is past a flat 1 GiB ceiling before any branch decompresses, and bound the zstd read to the declared size rather than letting read_to_end run unbounded. drops the with_capacity that reserved from the untrusted field.

the ceiling is deliberately a flat size, not a multiple of the compressed bytes. a ratio cap looks tighter but rejects real files: a blank tile compresses by more than 4000x, which broke the existing container round-trip test when i tried it.

tests cover both directions, the absurd declaration and an ordinary entry that must still decode.

before

before

after

after

@IAmJSD IAmJSD left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@IAmJSD
IAmJSD merged commit a56f98d into Infrawrench:main Aug 25, 2026
3 checks passed
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.

an affinity entry can declare an unbounded decompressed size

2 participants