From 81f5f96ebb5eac393b7a586ee77093d90b875490 Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Fri, 29 Jul 2022 03:37:22 +1000 Subject: [PATCH] Prevent the instruction category from being overwritten after a fused call/pop has been recognised (#612) * Prevent the instruction category from being overwritten after a fused call/pop has been recognised * Move assignment up and remove conditional --- lib/Arch/X86/Arch.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Arch/X86/Arch.cpp b/lib/Arch/X86/Arch.cpp index 8aa28590c..df39882f1 100644 --- a/lib/Arch/X86/Arch.cpp +++ b/lib/Arch/X86/Arch.cpp @@ -1046,6 +1046,8 @@ bool X86Arch::DecodeInstruction(uint64_t address, std::string_view inst_bytes, return false; } + inst.category = CreateCategory(xedd); + // Look for instruction fusing opportunities. For now, just `call; pop`. const char *is_fused_call_pop = nullptr; if (len < inst_bytes.size() && @@ -1072,7 +1074,6 @@ bool X86Arch::DecodeInstruction(uint64_t address, std::string_view inst_bytes, } } - inst.category = CreateCategory(xedd); inst.next_pc = address + len + extra_len; // Fiddle with the size of the bytes.