From e6358fce31089c40f88fd5215d0fb734b118f741 Mon Sep 17 00:00:00 2001 From: Christoph Jentzsch Date: Sat, 29 Nov 2014 09:38:48 +0100 Subject: [PATCH] Avoid memneed overflow --- libevm/VM.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libevm/VM.h b/libevm/VM.h index 8fdd3de92..2feb6c77e 100644 --- a/libevm/VM.h +++ b/libevm/VM.h @@ -173,15 +173,15 @@ template dev::bytesConstRef dev::eth::VM::go(Ext& _ext, OnOpFunc con // These all operate on memory and therefore potentially expand it: case Instruction::MSTORE: require(2); - newTempSize = m_stack.back() + 32; + newTempSize = (bigint)m_stack.back() + 32; break; case Instruction::MSTORE8: require(2); - newTempSize = m_stack.back() + 1; + newTempSize = (bigint)m_stack.back() + 1; break; case Instruction::MLOAD: require(1); - newTempSize = m_stack.back() + 32; + newTempSize = (bigint)m_stack.back() + 32; break; case Instruction::RETURN: require(2); @@ -236,9 +236,9 @@ template dev::bytesConstRef dev::eth::VM::go(Ext& _ext, OnOpFunc con case Instruction::CREATE: { require(3); - auto inOff = m_stack[m_stack.size() - 2]; - auto inSize = m_stack[m_stack.size() - 3]; - newTempSize = inOff + inSize; + u256 inOff = m_stack[m_stack.size() - 2]; + u256 inSize = m_stack[m_stack.size() - 3]; + newTempSize = (bigint)inOff + inSize; runGas = c_createGas; break; }