From 8a34dc0c1c7a0d299029d8b781bbddd104d80900 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 8 Oct 2014 16:40:08 +0200 Subject: [PATCH] JUMPDEST specifies point before which JUMP is allowed. --- libevm/VM.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libevm/VM.h b/libevm/VM.h index 399df72dd..982b97394 100644 --- a/libevm/VM.h +++ b/libevm/VM.h @@ -567,7 +567,7 @@ template dev::bytesConstRef dev::eth::VM::go(Ext& _ext, OnOpFunc con case Instruction::JUMP: require(1); nextPC = m_stack.back(); - if ((Instruction)_ext.getCode(nextPC) != Instruction::JUMPDEST) + if (nextPC && (Instruction)_ext.getCode(nextPC - 1) != Instruction::JUMPDEST) BOOST_THROW_EXCEPTION(BadJumpDestination()); m_stack.pop_back(); break; @@ -576,7 +576,7 @@ template dev::bytesConstRef dev::eth::VM::go(Ext& _ext, OnOpFunc con if (m_stack[m_stack.size() - 2]) { nextPC = m_stack.back(); - if ((Instruction)_ext.getCode(nextPC) != Instruction::JUMPDEST) + if (nextPC && (Instruction)_ext.getCode(nextPC - 1) != Instruction::JUMPDEST) BOOST_THROW_EXCEPTION(BadJumpDestination()); } m_stack.pop_back();