Skip to content

Commit

Permalink
test: ensure push_int check i32::MIN of overflow error
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCho-H authored Sep 26, 2024
1 parent c9988ba commit a33bcd3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bitcoin/src/blockdata/script/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,3 +916,9 @@ fn instruction_script_num_parse() {
Some(Ok(Instruction::PushBytes(PushBytes::empty()))),
);
}

#[test]
fn script_push_int_overflow() {
// Only errors if `data == i32::MIN` (CScriptNum cannot have value -2^31).
assert_eq!(Builder::new().push_int(i32::MIN), Err(Error::NumericOverflow));
}

0 comments on commit a33bcd3

Please sign in to comment.