Browse Source

max pc is uint64_t

cl-refactor
CJentzsch 10 years ago
parent
commit
0519bdbd71
  1. 4
      libevm/VM.cpp
  2. 2
      libevm/VM.h

4
libevm/VM.cpp

@ -546,7 +546,7 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps)
break;
case Instruction::JUMP:
nextPC = m_stack.back();
if (find(m_jumpDests.begin(), m_jumpDests.end(), nextPC) == m_jumpDests.end())
if (find(m_jumpDests.begin(), m_jumpDests.end(), (uint64_t)nextPC) == m_jumpDests.end() || nextPC > numeric_limits<uint64_t>::max() )
BOOST_THROW_EXCEPTION(BadJumpDestination());
m_stack.pop_back();
break;
@ -554,7 +554,7 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps)
if (m_stack[m_stack.size() - 2])
{
nextPC = m_stack.back();
if (find(m_jumpDests.begin(), m_jumpDests.end(), nextPC) == m_jumpDests.end())
if (find(m_jumpDests.begin(), m_jumpDests.end(), (uint64_t)nextPC) == m_jumpDests.end() || nextPC > numeric_limits<uint64_t>::max() )
BOOST_THROW_EXCEPTION(BadJumpDestination());
}
m_stack.pop_back();

2
libevm/VM.h

@ -74,7 +74,7 @@ private:
u256 m_curPC = 0;
bytes m_temp;
u256s m_stack;
std::vector<u256> m_jumpDests;
std::vector<uint64_t> m_jumpDests;
std::function<void()> m_onFail;
bigint m_gas = 0;
};

Loading…
Cancel
Save