mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6142 from ethereum/yul_interpreter_fix_overflow
yulInterpreter: Fix u256 overflow in logMemory.
This commit is contained in:
commit
0e475438a9
@ -460,10 +460,10 @@ bool EVMInstructionInterpreter::logMemory(bool _write, u256 const& _offset, u256
|
||||
size_t constexpr maxMemSize = 0x20000000;
|
||||
|
||||
logTrace(_write ? "MSTORE_AT_SIZE" : "MLOAD_FROM_SIZE", {_offset, _size}, _data);
|
||||
if (_offset + _size >= _offset)
|
||||
|
||||
if (((_offset + _size) >= _offset) && ((_offset + _size + 0x1f) >= (_offset + _size)))
|
||||
{
|
||||
u256 newSize = _offset + _size;
|
||||
newSize = (newSize + 0x1f) & ~u256(0x1f);
|
||||
u256 newSize = (_offset + _size + 0x1f) & ~u256(0x1f);
|
||||
m_state.msize = max(m_state.msize, newSize);
|
||||
if (newSize < maxMemSize)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user