Limit deserialization of program inputs (#6522)

This commit is contained in:
Jack May
2019-10-23 19:56:07 -07:00
committed by GitHub
parent 955d0ab76f
commit ddefc96433
12 changed files with 42 additions and 52 deletions

View File

@@ -4,11 +4,11 @@ use crate::{
budget_instruction::{BudgetError, BudgetInstruction},
budget_state::BudgetState,
};
use bincode::deserialize;
use chrono::prelude::{DateTime, Utc};
use log::*;
use solana_sdk::{
account::KeyedAccount, hash::hash, instruction::InstructionError, pubkey::Pubkey,
account::KeyedAccount, hash::hash, instruction::InstructionError,
instruction_processor_utils::limited_deserialize, pubkey::Pubkey,
};
/// Process a Witness Signature. Any payment plans waiting on this signature
@@ -106,10 +106,7 @@ pub fn process_instruction(
keyed_accounts: &mut [KeyedAccount],
data: &[u8],
) -> Result<(), InstructionError> {
let instruction = deserialize(data).map_err(|err| {
info!("Invalid transaction data: {:?} {:?}", data, err);
InstructionError::InvalidInstructionData
})?;
let instruction = limited_deserialize(data)?;
trace!("process_instruction: {:?}", instruction);