Solidity Bug Info
EmptyByteArrayCopyCopying an empty byte array (or string) from memory or calldata to storage can result in data corruption if the target array's length is increased subsequently without storing new data.
|The routine that copies byte arrays from memory or calldata to storage stores unrelated data from after the source array in the storage slot if the source array is empty. If the storage array's length is subsequently increased either by using ``.push()`` or by assigning to its ``.length`` attribute (only before 0.6.0), the newly created byte array elements will not be zero-initialized, but contain the unrelated data. You are not affected if you do not assign to ``.length`` and do not use ``.push()`` on byte arrays, or only use ``.push(|
- Link: https://blog.soliditylang.org/2020/10/19/empty-byte-array-copy-bug/
- First Introduced:
- Fixed in Version: 0.7.4
- Severity<: medium