Repository navigation
fix: Fixed-schema decode allocates attacker-chosen size with no budget check - #640
Merged
martin-g merged 3 commits intoAug 26, 2026
Conversation
martin-g
commented
Aug 25, 2026
martin-g
force-pushed
the
bound-allocated-bytes-for-fixed-schema-size
branch
from
August 25, 2026 12:02
e51c6d7 to
08c5625
Compare
martin-g
changed the base branch from
main
to
track-allocated-bytes-during-decoding
August 25, 2026 12:02
martin-g
marked this pull request as ready for review
August 25, 2026 12:04
Kriskras99
requested changes
Aug 26, 2026
Comment on lines
+775
to
+779
| // A fixed schema's size directs decoders to allocate that many bytes, | ||
| // and the schema itself may be attacker-supplied (e.g. an OCF header). | ||
| // Always bound it before allocating. | ||
| let size = usize::try_from(size).map_err(|e| Details::ConvertU64ToUsize(e, size))?; | ||
| let size = safe_len(size)?; |
Contributor
There was a problem hiding this comment.
I don't think the schema parser is the right place to do this. This should only be done in de reader/decoder.
Member
Author
There was a problem hiding this comment.
Agreed!
Reverted the check!
…t check Cap allocations to max_allocation_bytes when decoding OCF / deserializing schemas Reported-by: Security scans
martin-g
force-pushed
the
bound-allocated-bytes-for-fixed-schema-size
branch
from
August 26, 2026 09:55
616fa6b to
11013a3
Compare
Kriskras99
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cap allocations to max_allocation_bytes when decoding OCF / deserializing schemas
Reported-by: Security scans