Skip to content

Commit e5d0f63

Browse files
committed
evmasm: Fix unchecked overflow in legacy codegen array size computation
1 parent 33aac98 commit e5d0f63

8 files changed

Lines changed: 181 additions & 8 deletions

File tree

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Language Features:
44

55
Compiler Features:
66

7+
Important Bugfixes:
8+
* Evmasm Code Generator: Fix unchecked multiplication overflow when computing the storage size of dynamic arrays during deletion, which could result in ``delete`` silently leaving stale data in storage.
9+
710
Bugfixes:
811

912

docs/bugs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
[
2+
{
3+
"uid": "SOL-2026-2",
4+
"name": "EvmasmCodegenUncheckedArraySizeOverflow",
5+
"summary": "Deleting a dynamic array of large static arrays could silently skip storage clearing due to an unchecked multiplication overflow in the evmasm code generator.",
6+
"description": "When the legacy (evmasm) code generator computes the total number of storage slots occupied by an array, it multiplies the array length by the storage size of its base type. This multiplication was performed without an overflow check, so when the product exceeded ``2**256``, the result would wrap to a small value (or zero). This caused the subsequent clearing loop to process fewer slots than necessary, leaving stale data in storage. The bug could be triggered by using the ``delete`` operator on a dynamic storage array whose base type is large enough for the product to overflow. The IR pipeline was not affected, because it already used overflow-checked arithmetic for this computation. With the fix, the Evmasm code generator now reverts with an arithmetic overflow panic in this situation, matching the via-IR behavior.",
7+
"link": "",
8+
"introduced": "0.1.0",
9+
"fixed": "0.8.35",
10+
"severity": "low",
11+
"conditions": {
12+
"viaIR": false
13+
}
14+
},
215
{
316
"uid": "SOL-2026-1",
417
"name": "TransientStorageClearingHelperCollision",

0 commit comments

Comments
 (0)