Fix unsafe add (#2444)

This commit is contained in:
Britt Cyr 2023-03-24 13:03:33 -04:00 committed by GitHub
parent 5e13431aca
commit 7ee4a7a047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -273,7 +273,7 @@ pub fn idl_accounts_and_functions() -> proc_macro2::TokenStream {
anchor_lang::prelude::msg!("Instruction: IdlWrite");
let prev_len: usize = ::std::convert::TryInto::<usize>::try_into(accounts.idl.data_len).unwrap();
let new_len: usize = prev_len + idl_data.len();
let new_len: usize = prev_len + idl_data.len() as usize;
accounts.idl.data_len = accounts.idl.data_len.checked_add(::std::convert::TryInto::<u32>::try_into(idl_data.len()).unwrap()).unwrap();
use IdlTrailingData;