2 bytes length check
This commit is contained in:
parent
f4ab64fd6b
commit
95e96a653f
@ -389,3 +389,18 @@ fn test_the_exact_long_string()
|
||||
let as_val: Result<String, DecoderError> = rlp.as_val();
|
||||
assert!(as_val.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rlp_2bytes_data_length_check()
|
||||
{
|
||||
let mut data: Vec<u8> = vec![0xb9, 2, 255]; // 512+255
|
||||
for _ in 0..700 {
|
||||
data.push(b'c');
|
||||
}
|
||||
|
||||
let rlp = UntrustedRlp::new(&data);
|
||||
|
||||
let as_val: Result<String, DecoderError> = rlp.as_val();
|
||||
assert_eq!(Err(DecoderError::RlpInconsistentLengthAndData), as_val);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user