Skip to content

Commit

Permalink
Add missing feature flag check for 0 signatures in secp256k1 verify
Browse files Browse the repository at this point in the history
  • Loading branch information
mjain-jump committed Aug 28, 2024
1 parent 4f4d679 commit bae03a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/flamenco/runtime/program/fd_precompiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,12 @@ fd_precompile_secp256k1_verify( fd_exec_txn_ctx_t * txn_ctx,
return FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
}

/* https://github.com/anza-xyz/agave/blob/574bae8fefc0ed256b55340b9d87b7689bcdf222/sdk/src/secp256k1_instruction.rs#L938-L947 */
ulong sig_cnt = data[0];
if( FD_UNLIKELY( sig_cnt==0 ) ) {
if( FD_UNLIKELY( ( FD_FEATURE_ACTIVE( txn_ctx->slot_ctx, libsecp256k1_fail_on_bad_count ) ||
FD_FEATURE_ACTIVE( txn_ctx->slot_ctx, libsecp256k1_fail_on_bad_count2 ) ) &&
sig_cnt==0 &&
data_sz>1 ) ) {
return FD_EXECUTOR_PRECOMPILE_ERR_INSTR_DATA_SIZE;
}

Expand Down

0 comments on commit bae03a9

Please sign in to comment.