paritytech / paritytech/parity-common
rlp: list length and contents are not validated
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 311
- Forks
- 245
- PR merge metrics
- No merged PRs in 30d
Description
Three examples that should be rejected
let invalid_rlp = [193, 4, 4];
let rlp = rlp::Rlp::new(&invalid_rlp);
let item_count = rlp.item_count().unwrap(); // this should fail
assert_eq!(item_count, 2); // wrong. invalid rlp with a list of one element followed by extra
// data that ends up being assumed as part of the list
let invalid_rlp = [195, 2, 247, 247];
let rlp = rlp::Rlp::new(&invalid_rlp);
let item_count = rlp.item_count().unwrap(); // should fail
assert_eq!(item_count, 1); // wrong. invalid rlp with a list of 3 bytes where only the first
// one is valid rlp
let invalid_rlp = [194, 1];
let rlp = rlp::Rlp::new(&invalid_rlp);
let item_count = rlp.item_count().unwrap(); // should fail
assert_eq!(item_count, 0); // wrong. list should occupy two bytes, occupies just one and it's
// still accepted
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Rlp::item_count entry point and trace how list lengths and nested item boundaries are validated. Add regression coverage for the three byte sequences in the issue, with completion meaning each malformed list is rejected rather than returning an item count.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100