You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DynSolType::decode_single will panic when it encounters certain data.
Expected Behavior vs. Actual Behavior
Expected decode_single to result in a Result::Err(..) value if it's unable to decode given data, instead it panics bringing the whole program to a halt.
How to reproduce:
Run the following snippet
use alloy_dyn_abi::DynSolType;use hex_literal::hex;use std::string::String;fnmain() -> Result<(),String>{let my_type:DynSolType = "(string[],bytes13,bytes13[2])".parse().map_err(|err| format!("Failed to parse: {}", err))?;let decoded = my_type
.decode_single(&hex!("000000000000000000000000000000000000000000000000000000000000008093dd71318b60d9fa85991e7149000000000000000000000000000000000000004f1a284fd349323201bfb3e41a00000000000000000000000000000000000000b99bf51f6dbbddbea4defb6b1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001f755f382c5a725e095a4d4c57244f433f0d3435360d335d766b712850594a53000000000000000000000000000000000000000000000000000000000000000010475e6272723d456b49225f095e51432b00000000000000000000000000000000")).map_err(|err| format!("Failed to decode: {}", err));println!("decoded: {decoded:?}");Ok(())}
It should result in the following panic:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Overrun', /home/philippe/.cargo/git/checkouts/core-3f428e9ca4699f0e/ca37a23/crates/dyn-abi/src/token.rs:169:65
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Note the above data is valid and will be decoded successfully by decode_params and decode_sequence.
The text was updated successfully, but these errors were encountered:
Component
dyn-abi
What version of Alloy are you on?
v0.2.0 commit ca37a23
Operating System
Linux
Describe the bug
Description
DynSolType::decode_single
will panic when it encounters certain data.Expected Behavior vs. Actual Behavior
Expected
decode_single
to result in aResult::Err(..)
value if it's unable to decode given data, instead it panics bringing the whole program to a halt.How to reproduce:
Run the following snippet
It should result in the following panic:
Note the above data is valid and will be decoded successfully by
decode_params
anddecode_sequence
.The text was updated successfully, but these errors were encountered: