Skip to content

Commit

Permalink
fix: unchecked math in new_secp256r1_instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRigel committed Nov 6, 2024
1 parent fd7bbb6 commit 1522fcc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/secp256r1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ mod target_arch {

let mut padded_r = vec![0u8; FIELD_SIZE];
let mut padded_s = vec![0u8; FIELD_SIZE];
padded_r[FIELD_SIZE - r.len()..].copy_from_slice(&r);
padded_s[FIELD_SIZE - s.len()..].copy_from_slice(&s);
padded_r[FIELD_SIZE.saturating_sub(r.len())..].copy_from_slice(&r);
padded_s[FIELD_SIZE.saturating_sub(s.len())..].copy_from_slice(&s);

signature[..FIELD_SIZE].copy_from_slice(&padded_r);
signature[FIELD_SIZE..].copy_from_slice(&padded_s);
Expand Down

0 comments on commit 1522fcc

Please sign in to comment.