Skip to content

Commit

Permalink
Prevent fail on u8 overflow (#418)
Browse files Browse the repository at this point in the history
* Prevent u8 overflow
  • Loading branch information
oxade committed Feb 11, 2022
1 parent d75b684 commit a6a9957
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fastpay_core/src/unit_tests/authority_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,8 @@ async fn test_get_latest_parent_entry() {
// The objects just after the gas object also returns None
let mut x = gas_object_id.to_vec();
let last_index = x.len() - 1;
x[last_index] += 1;
// Prevent overflow
x[last_index] = u8::MAX - x[last_index];
let unknown_object_id: ObjectID = x.try_into().unwrap();
assert!(authority_state
.get_latest_parent_entry(unknown_object_id)
Expand Down

0 comments on commit a6a9957

Please sign in to comment.