Skip to content

rlp: validate and cache element count in RawList#2655

Merged
ucwong merged 1 commit into
masterfrom
dev
Feb 20, 2026
Merged

rlp: validate and cache element count in RawList#2655
ucwong merged 1 commit into
masterfrom
dev

Conversation

@ucwong
Copy link
Copy Markdown
Member

@ucwong ucwong commented Feb 20, 2026

This changes RawList to ensure the count of items is always valid. Lists with invalid structure, i.e. ones where an element exceeds the size of the container, are now detected during decoding of the RawList and thus cannot exist.

Also remove RawList.Empty since it is now fully redundant, and Iterator.Count since it returns incorrect results in the presence of invalid input. There are no callers of these methods (yet).

This changes `RawList` to ensure the count of items is always valid.
Lists with invalid structure, i.e. ones where an element exceeds the
size of the container, are now detected during decoding of the `RawList`
and thus cannot exist.

Also remove `RawList.Empty` since it is now fully redundant, and
`Iterator.Count` since it returns incorrect results in the presence of
invalid input. There are no callers of these methods (yet).
@ucwong ucwong marked this pull request as ready for review February 20, 2026 08:44
@ucwong ucwong merged commit 3a90ca0 into master Feb 20, 2026
1 check failed
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