add unit test for overflow panic

This commit is contained in:
Andrew Poelstra 2017-06-07 16:05:46 +00:00
parent 287d285214
commit 2e7be81ea4
1 changed files with 2 additions and 0 deletions

View File

@ -496,6 +496,8 @@ mod tests {
fn deserialize_vec_test() {
assert_eq!(deserialize(&[3u8, 2, 3, 4]).ok(), Some(vec![2u8, 3, 4]));
assert_eq!(deserialize(&[4u8, 2, 3, 4, 5, 6]).ok(), Some(vec![2u8, 3, 4, 5]));
// found by cargo fuzz
assert!(deserialize::<Vec<u64>>(&[0xff,0xff,0xff,0xff,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0xa,0xa,0x3a]).is_err());
}
#[test]