Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rlp: list length and contents are not validated #774

Open
divagant-martian opened this issue Aug 8, 2023 · 0 comments
Open

rlp: list length and contents are not validated #774

divagant-martian opened this issue Aug 8, 2023 · 0 comments

Comments

@divagant-martian
Copy link

divagant-martian commented Aug 8, 2023

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
@divagant-martian divagant-martian changed the title rlp: list length is not validated rlp: list length and contents are not validated Aug 9, 2023
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

No branches or pull requests

1 participant