|
@ -71,7 +71,7 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) |
|
|
for (unsigned i = 0; i < _ext.code.size(); ++i) |
|
|
for (unsigned i = 0; i < _ext.code.size(); ++i) |
|
|
{ |
|
|
{ |
|
|
if (_ext.code[i] == (byte)Instruction::JUMPDEST) |
|
|
if (_ext.code[i] == (byte)Instruction::JUMPDEST) |
|
|
m_jumpDests.insert(i); |
|
|
m_jumpDests.push_back(i); |
|
|
else if (_ext.code[i] >= (byte)Instruction::PUSH1 && _ext.code[i] <= (byte)Instruction::PUSH32) |
|
|
else if (_ext.code[i] >= (byte)Instruction::PUSH1 && _ext.code[i] <= (byte)Instruction::PUSH32) |
|
|
i += _ext.code[i] - (unsigned)Instruction::PUSH1 + 1; |
|
|
i += _ext.code[i] - (unsigned)Instruction::PUSH1 + 1; |
|
|
} |
|
|
} |
|
@ -546,7 +546,7 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) |
|
|
break; |
|
|
break; |
|
|
case Instruction::JUMP: |
|
|
case Instruction::JUMP: |
|
|
nextPC = m_stack.back(); |
|
|
nextPC = m_stack.back(); |
|
|
if (!m_jumpDests.count(nextPC)) |
|
|
if (find(m_jumpDests.begin(), m_jumpDests.end(), nextPC) == m_jumpDests.end()) |
|
|
BOOST_THROW_EXCEPTION(BadJumpDestination()); |
|
|
BOOST_THROW_EXCEPTION(BadJumpDestination()); |
|
|
m_stack.pop_back(); |
|
|
m_stack.pop_back(); |
|
|
break; |
|
|
break; |
|
@ -554,7 +554,7 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) |
|
|
if (m_stack[m_stack.size() - 2]) |
|
|
if (m_stack[m_stack.size() - 2]) |
|
|
{ |
|
|
{ |
|
|
nextPC = m_stack.back(); |
|
|
nextPC = m_stack.back(); |
|
|
if (!m_jumpDests.count(nextPC)) |
|
|
if (find(m_jumpDests.begin(), m_jumpDests.end(), nextPC) == m_jumpDests.end()) |
|
|
BOOST_THROW_EXCEPTION(BadJumpDestination()); |
|
|
BOOST_THROW_EXCEPTION(BadJumpDestination()); |
|
|
} |
|
|
} |
|
|
m_stack.pop_back(); |
|
|
m_stack.pop_back(); |
|
|