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

bug: decode_multiple can overflow #1215

Closed
iqdecay opened this issue Nov 24, 2023 · 0 comments · Fixed by #1227
Closed

bug: decode_multiple can overflow #1215

iqdecay opened this issue Nov 24, 2023 · 0 comments · Fixed by #1227

Comments

@iqdecay
Copy link
Contributor

iqdecay commented Nov 24, 2023

During a fuzzing campaign, it turned out that this test panics with an attempt to add with overflow:

        let param_types = vec![ParamType::Enum {
            variants: EnumVariants::new(vec![ParamType::Struct {
                fields: vec![
                    ParamType::StringArray(12514849900987264429),
                    ParamType::StringArray(7017071859781709229),
                ],
                generics: vec![],
            }])
            .unwrap(),
            generics: vec![],
        }];
        let bytes = vec![];
        let a = ABIDecoder::default().decode_multiple(&param_types, &bytes);

at the decode_multiple step.
We should probably enforce some upper limit on the length of StringArray and Array.

iqdecay added a commit that referenced this issue Jan 10, 2024
Closes #1215 by fixing the way encoding size is computed.

---------
Co-authored-by: MujkicA <32431923+MujkicA@users.noreply.github.com>
Co-authored-by: Rodrigo Araújo <rod.dearaujo@gmail.com>
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 a pull request may close this issue.

1 participant