diff --git a/ethabi/src/decoder.rs b/ethabi/src/decoder.rs index 020dcd0aa..c55ffb813 100644 --- a/ethabi/src/decoder.rs +++ b/ethabi/src/decoder.rs @@ -165,9 +165,9 @@ fn decode_param(param: &ParamType, data: &[u8], offset: usize) -> Result data.len() { - return Err(Error::InvalidData); - } + if offset > data.len() { + return Err(Error::InvalidData); + } (&data[offset..], 0) } else { (data, offset)