diff --git a/src/support/ssz.rs b/src/support/ssz.rs index a544cd1..403c68d 100644 --- a/src/support/ssz.rs +++ b/src/support/ssz.rs @@ -32,6 +32,12 @@ impl Decode for Uint { } fn from_ssz_bytes(bytes: &[u8]) -> Result { + if bytes.len() > nbytes(BITS) { + return Err(DecodeError::InvalidByteLength { + len: bytes.len(), + expected: nbytes(BITS), + }); + } Ok(Self::from_le_slice(bytes)) } }