Skip to content

fix: OCF block message count unbounded with zero-byte-consuming decode - #643

Merged
martin-g merged 1 commit into
mainfrom
04-block-message-count-unbounded
Aug 27, 2026
Merged

martin-g merged 1 commit into
mainfrom
04-block-message-count-unbounded

Conversation

@martin-g

Copy link
Copy Markdown
Member

After decompression, if the declared count exceeds the number of bytes actually in the block (only possible when some datums are zero-width, e.g. schema "null"), the count itself must pass safe_collection_len:: — i.e. the number of conjurable-from-nothing objects is bounded by the allocation budget (~16-21M at the 512MB default) instead of being trusted. Counts backed by at least one byte per object are unchanged, and the existing :209 guard still errors when a non-empty buffer yields a zero-consumption decode.

Reported-by: Security scans

@martin-g
martin-g requested a review from Kriskras99 August 25, 2026 13:36
@martin-g martin-g added this to the 0.23.0 milestone Aug 25, 2026
@martin-g
martin-g force-pushed the 04-block-message-count-unbounded branch 2 times, most recently from 2f185e3 to 7d4c595 Compare August 26, 2026 11:10
@martin-g
martin-g force-pushed the 04-block-message-count-unbounded branch from 7d4c595 to debb80f Compare August 26, 2026 11:13
Base automatically changed from recursion-depth-check-decoding-deserializing to main August 26, 2026 15:40
After decompression, if the declared count exceeds the number of bytes actually in the block
(only possible when some datums are zero-width, e.g. schema "null"), the count itself must
pass safe_collection_len::<Value> — i.e. the number of conjurable-from-nothing objects is
bounded by the allocation budget (~16-21M at the 512MB default) instead of being trusted.
Counts backed by at least one byte per object are unchanged, and the existing :209 guard
still errors when a non-empty buffer yields a zero-consumption decode.

Reported-by: Security scans
@martin-g
martin-g force-pushed the 04-block-message-count-unbounded branch from debb80f to 799bd1a Compare August 26, 2026 15:40
@martin-g
martin-g merged commit 5f22c34 into main Aug 27, 2026
4 of 16 checks passed
@martin-g
martin-g deleted the 04-block-message-count-unbounded branch August 27, 2026 06:44
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.

2 participants