-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Fix unchecked overflow in legacy codegen array size computation #16481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
r0qs
wants to merge
5
commits into
develop
Choose a base branch
from
fix-unchecked-mul-storage-array-clear
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
15bf374
evmasm: Fix unchecked overflow in legacy codegen array size computation
r0qs 349fefe
evmasm: Add overflow check for index access on storage arrays with mu…
r0qs 53c9dd6
via-ir: Fix unchecked overflow in storage array index access for mult…
r0qs 4ccaa67
Update changelog
r0qs 406b888
Update bug list
r0qs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,14 @@ | ||
| [ | ||
| { | ||
| "uid": "SOL-2026-2", | ||
| "name": "UncheckedArrayStorageSizeOverflow", | ||
| "summary": "Operations on storage arrays whose base type is large enough for the product of the element count or index and the storage size to overflow could silently corrupt storage due to unchecked multiplication overflow.", | ||
| "description": "When computing storage slot offsets for array operations, the code generators multiply a value (array length or element index) by the storage size of the base type. This multiplication was performed without an overflow check in several places, so when the product exceeded ``2**256``, the result would wrap to a smaller value. This affected two operations: (1) deleting a dynamic storage array (legacy code generator only, the IR code generator already used overflow-checked arithmetic for this), where the clearing loop would process fewer slots than necessary, leaving stale data in storage; (2) accessing an element by index (both code generators), where the access would silently read from or write to an incorrect storage slot, leading to data corruption. The bug required a dynamic storage array whose base type occupies enough slots for the relevant product to overflow (e.g., ``uint256[2**255][]`` where the base type occupies ``2**255`` slots). With the fix, both code generators now revert with an arithmetic overflow panic in these situations.", | ||
| "link": "", | ||
| "introduced": "0.1.0", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The oldest version I could test using Remix was |
||
| "fixed": "0.8.35", | ||
| "severity": "low" | ||
| }, | ||
| { | ||
| "uid": "SOL-2026-1", | ||
| "name": "TransientStorageClearingHelperCollision", | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.