Skip to content

Commit a33bcd3

Browse files
authored
test: ensure push_int check i32::MIN of overflow error
1 parent c9988ba commit a33bcd3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bitcoin/src/blockdata/script/tests.rs

+6
Original file line numberDiff line numberDiff line change
@@ -916,3 +916,9 @@ fn instruction_script_num_parse() {
916916
Some(Ok(Instruction::PushBytes(PushBytes::empty()))),
917917
);
918918
}
919+
920+
#[test]
921+
fn script_push_int_overflow() {
922+
// Only errors if `data == i32::MIN` (CScriptNum cannot have value -2^31).
923+
assert_eq!(Builder::new().push_int(i32::MIN), Err(Error::NumericOverflow));
924+
}

0 commit comments

Comments
 (0)