Rust's AccountInfo
contains immutable members that might be changed by the runtime or other programs
#14692
Milestone
AccountInfo
contains immutable members that might be changed by the runtime or other programs
#14692
Problem
AccountInfo
contains currently two members that may be changed by the runtime or other programs but are currently defined as immutable.There are
data
because it is a slice. The program itself is not allowed to modify the length of the slice but the program may want to call the system program toCreateAccount
orRealloc
which changes the size of a program's data. CurrentlyCreateAccount
is supported up to a size of 10k only.Reassign
which does.The issue with the above two members is that when the program is compiled the Rust compiler thinks the data length and the owner are immutable and thus may make assumptions based on that. For example, the compiler might keep the data's length in a register across a call to
CreateAccount
which would lead the program to use a stale value after the call.Proposed Solution
Rework the program's entrypoint parameter types to correctly describe data malleability.
The text was updated successfully, but these errors were encountered: