Skip to content

Commit

Permalink
add: num_signatures == 0 check from SIMD-0152
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRigel committed Oct 13, 2024
1 parent 226eeef commit 8f18340
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions sdk/src/ed25519_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pub fn verify(
return Err(PrecompileError::InvalidInstructionDataSize);
}
let num_signatures = data[0] as usize;

if num_signatures == 0 && data.len() > SIGNATURE_OFFSETS_START {
return Err(PrecompileError::InvalidInstructionDataSize);
}
Expand Down
4 changes: 3 additions & 1 deletion sdk/src/secp256r1_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ pub fn verify(
return Err(PrecompileError::InvalidInstructionDataSize);
}
let num_signatures = data[0] as usize;

if num_signatures == 0 {
return Err(PrecompileError::InvalidInstructionDataSize);
}
if num_signatures > 8 {
return Err(PrecompileError::InvalidInstructionDataSize);
}
Expand Down

0 comments on commit 8f18340

Please sign in to comment.