From 3f0b92cf4d1e7f9f5ba40f2e915dfa9964a00ce2 Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Wed, 17 Jul 2019 12:23:36 +0200 Subject: [PATCH] Replace optimizer-special opcodes with 0xaf instead of INVALID. This way when PUSHC/JUMPC/JUMPCI are encountered in input code, EVMC_UNDEFINED_INSTRUCTION will be returned and not EVMC_INVALID_INSTRUCTION. --- libaleth-interpreter/VMOpt.cpp | 2 +- libevm/Instruction.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libaleth-interpreter/VMOpt.cpp b/libaleth-interpreter/VMOpt.cpp index 3c03085dfc9..4e9af153315 100644 --- a/libaleth-interpreter/VMOpt.cpp +++ b/libaleth-interpreter/VMOpt.cpp @@ -72,7 +72,7 @@ void VM::optimize() ) { TRACE_OP(1, pc, op); - m_code[pc] = (byte)Instruction::INVALID; + m_code[pc] = (byte)Instruction::UNDEFINED; } if (op == Instruction::JUMPDEST) diff --git a/libevm/Instruction.h b/libevm/Instruction.h index 9f4ff2f1360..867931824a0 100644 --- a/libevm/Instruction.h +++ b/libevm/Instruction.h @@ -172,6 +172,7 @@ enum class Instruction : uint8_t PUSHC = 0xac, ///< push value from constant pool JUMPC, ///< alter the program counter - pre-verified JUMPCI, ///< conditionally alter the program counter - pre-verified + UNDEFINED, ///< Replaces PUSHC/JUMPC/JUMPCI in the original code JUMPTO = 0xb0, ///< alter the program counter to a jumpdest JUMPIF, ///< conditionally alter the program counter