* Fix integer overflow in degenerate invoke_signed BPF syscalls (#15051)
(cherry picked from commit ebbaa1f8ea
)
# Conflicts:
# programs/bpf_loader/src/syscalls.rs
* resolve conflicts
Co-authored-by: Mrmaxmeier <Mrmaxmeier@gmail.com>
Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
@ -1270,7 +1270,10 @@ fn check_instruction_size(
|
|||||||
data_len: usize,
|
data_len: usize,
|
||||||
max_size: usize,
|
max_size: usize,
|
||||||
) -> Result<(), EbpfError<BPFError>> {
|
) -> Result<(), EbpfError<BPFError>> {
|
||||||
if max_size < num_accounts * size_of::<AccountMeta>() + data_len {
|
let size = num_accounts
|
||||||
|
.saturating_mul(size_of::<AccountMeta>())
|
||||||
|
.saturating_add(data_len);
|
||||||
|
if size > max_size {
|
||||||
return Err(
|
return Err(
|
||||||
SyscallError::InstructionError(InstructionError::ComputationalBudgetExceeded).into(),
|
SyscallError::InstructionError(InstructionError::ComputationalBudgetExceeded).into(),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user