A significant bug within the Solidity code generator has been officially disclosed following a report submitted through the Ethereum Foundation’s bug bounty program. Discovered by researcher Shaheen Fazim on August 14, 2026, the defect causes the delete operation on memory-based bytes and string array elements to write a full 32-byte word of zeroes rather than safely clearing a single byte. This unintended memory overwrite behavior affects a wide range of historical and current compiler iterations, prompting an immediate update from the development team.
According to the technical assessment released alongside the patch, applying the delete operator to an element of a memory-bound byte array triggers code generation that wipes out not just the targeted element, but also up to 31 subsequent bytes. Depending on where the operation occurs, this overflow can corrupt neighboring data within the same dynamic array or spill over into adjacent memory allocations entirely. Conversely, equivalent direct assignments—such as setting an array element to zero via standard assignment syntax—operate correctly and limit changes to a single byte.
The Ethereum Foundation’s Solidity team has classified this vulnerability with a "low/medium" severity rating on their internal scale. Notably, the flaw is strictly confined to the default evmasm pipeline. Contracts compiled using the alternative Intermediate Representation (IR) pipeline remain entirely unaffected. Furthermore, whether the optimizer is enabled has no bearing on the presence of the bug, as the faulty semantics are deeply baked into the baseline code emission stage regardless of optimization settings.
Historical analysis reveals that the affected code path predates the very first official release version of Solidity. Consequently, all compiler versions up to and including 0.8.37 are vulnerable to this behavior. To address the issue, developers rolled out a fix in version 0.8.37, bringing the delete operation into alignment with standard element assignments by ensuring it consults the correct element width and emits a single-byte store (mstore8) instead of a full 32-byte word store.
To gauge the real-world impact of the bug, the Solidity team conducted a comprehensive scan of the Sourcify database, analyzing approximately 870,000 verified smart contract compilations for the specific source pattern known to trigger the defect. The scan identified the pattern in a mere 17 compilations, encompassing just two distinct functions. Upon further inspection, neither of those functions was found to be adversely impacted in practice. In one instance, the overwritten bytes were subsequently discarded or overridden; in the other, no critical data occupied the memory space reached by the overflow. To date, no deployed production contracts are known to have suffered malicious exploitation or unintended state corruption as a result of this bug.
Which Contracts Are Affected?
Understanding the precise conditions under which this bug manifests is crucial for smart contract auditors and developers reviewing existing codebases. A contract is only vulnerable if it satisfies a specific set of parameters revolving around compiler settings, data types, and memory architecture.
First, the contract must be compiled using the default evmasm pipeline. Projects utilizing the IR pipeline are completely immune to the defect. Second, the code must explicitly invoke the delete operator on an element of a dynamic bytes array or a string that has been explicitly cast to bytes residing in memory.
The distinction regarding storage location is vital. Byte arrays stored permanently in blockchain storage use an entirely separate code-generation path and do not exhibit this behavior. Similarly, calldata arrays and arrays whose individual elements naturally occupy a full 32-byte memory word—such as bytes1[] memory—remain completely unaffected because their elements are already wide enough to match word boundaries. Only packed arrays, namely bytes and string, pack elements back-to-back without gaps, making them uniquely susceptible when indexed.
Developers should also note that deleting an entire array via delete b follows a separate, functioning code path and does not trigger the bug. The defect is strictly localized to element-level deletions using indices. Because strings share the same underlying memory representation as byte arrays, converting a string to a bytes type and executing an indexed deletion on it will invoke the flawed code path, modifying the string data in place.
Technical Details and Memory Internals
To fully understand why the bug occurs, it is necessary to examine how Solidity manages memory allocation and data representation. Most data types in the Ethereum Virtual Machine (EVM) memory occupy a full 32-byte word. Dynamic byte arrays serve as a prominent exception: they consist of an initial 32-byte length descriptor followed by the raw data bytes packed sequentially back-to-back without internal padding.
Solidity manages dynamic memory by continuously advancing a free memory pointer. Each new allocation begins precisely where the previous one terminates. In typical scenarios involving arrays created via new bytes(n) or populated from string and byte literals, the compiler appends up to 31 zero bytes of padding at the end of the array to ensure that any subsequent memory allocation starts cleanly on a fresh word boundary. These are categorized as padded arrays.

However, certain modern features and functions—including bytes.concat, string.concat, and the entire family of abi.encode functions—produce unpadded arrays. In these instances, the data ends abruptly without trailing padding bytes, meaning the next allocated structure sits flush against the end of the array data.
When developers write assignment statements like b[i] = 0, the compiler leverages its awareness of element widths to issue a targeted mstore8 instruction, writing a single zero byte into the precise memory slot. Historically, however, the compiler’s delete path for array elements diverged from this logic in the evmasm pipeline. Instead of utilizing a single-byte store, it erroneously deployed a full-word memory write (mstore), outputting 32 consecutive zero bytes starting directly at the index of the deleted element.
Because the write initiates at the specific byte offset of the array element rather than aligning to a 32-byte word boundary, it spills across multiple words. While the preceding length field of the array remains untouched, everything from the target element onward is overwritten with zeroes. Crucially, the length property of the array itself does not change, meaning subsequent operations—such as calculating a keccak256 cryptographic hash, performing ABI encoding, or returning the array data to an external caller—will process the silently corrupted payload.
The extent of the corruption depends heavily on the array’s length, its padding status, and the index of the deleted element. For padded arrays, the trailing padding bytes act as a buffer, absorbing the initial spillover of the 32-byte zero write. Deletions occurring near the beginning or middle of a padded array will corrupt adjacent elements within the array itself. Deletions targeting the final 31 elements may reach past the end of the array, encroaching into whatever memory structure was allocated immediately afterward.
For unpadded arrays, because there is no trailing buffer, deleting any of the final 31 elements—or any element at all in arrays shorter than 32 bytes—will invariably spill over into the subsequent memory allocation. If that adjacent memory houses a right-aligned value such as a uint256 integer or an address pointer, the leading bytes of that value will be wiped out, fundamentally altering its numeric value or rendering references invalid.
Illustrative Example and Practical Behavior
To demonstrate the real-world manifestation of this memory corruption, researchers constructed an experimental contract illustrating both internal array corruption and external memory spillover.
When a function allocates a short memory byte array containing five bytes—such as hex"0102030405"—and subsequently calls delete d[0], the developer would logically expect only the first byte to clear, leaving hex"0002030405". Under the vulnerable evmasm compilation, however, the 32-byte zero write consumes the entire allocated word, resulting in hex"0000000000" and unexpectedly wiping out the remaining elements of the array.
A more severe scenario involves inter-variable corruption. If a contract allocates a 32-byte padded byte array and immediately declares a large integer structure right afterward in memory, deleting the final element of the array (b[31]) causes the 32-byte zero write to bleed directly into the adjacent structure. Because integers are stored in memory with their most significant bytes placed first, the overwrite zeroes out the primary bytes of the target variable. In test cases involving maximum integer values like type(uint256).max, the corruption strips away the upper 31 bytes of 0xff values, leaving only the trailing byte intact and causing the function to return an erroneous result of 255 instead of the expected maximum integer.
Recommended Actions and Mitigation
Because this bug manifests silently without triggering compiler warnings or runtime exceptions, developers maintaining existing codebases should perform thorough audits to verify whether their applications interact with memory-based byte or string element deletions.
The primary recommendation for all developers is to upgrade their Solidity toolchain to version 0.8.37 or later. Projects unable to update immediately should review their source code to ensure that dynamic memory byte arrays and strings are not subjected to indexed delete operations while utilizing the default evmasm compilation pipeline. Transitioning compilation targets to the IR pipeline or replacing element deletions with explicit zero-assignments—such as assigning 0 directly to the target index—serves as an effective workaround for legacy compiler environments.
The Ethereum Foundation expressed gratitude to security researcher Shaheen Fazim for identifying the vulnerability through the official bug bounty channels and for providing a comprehensive reproduction test case that enabled the core development team to isolate and resolve the issue swiftly.






