Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(levm): avoid overflow in calldataload (#1461)
If the offset is larger than calldata, then there is no data to show. Return 0 to the stack **Motivation** The calldata operand tried to cast the value it got as an argument to usize everytime. However, that number could be larger than usize and an error is raised. <!-- Why does this pull request exist? What are its goals? --> **Description** This tries to check the offset value before casting it to usize. If the offset value (in U256) is _larger_ than the actual length of contents of the calldata (also in U256), then we simply return 0 (since the offset would've removed all the values from calldata). <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 -->
- Loading branch information