From 96188edc42aa6503be0557b0b93ca59838ba615d Mon Sep 17 00:00:00 2001 From: xtremegamer1 Date: Sat, 8 Oct 2022 03:31:55 -0600 Subject: [PATCH] Guarantee that there is an instruction after the last write to VIP. Also fix mistake when writing to img_based. --- src/vmemu_t.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vmemu_t.cpp b/src/vmemu_t.cpp index 970c63e..5384677 100644 --- a/src/vmemu_t.cpp +++ b/src/vmemu_t.cpp @@ -370,7 +370,7 @@ bool emu_t::code_exec_callback(uc_engine* uc, uint64_t address, uint32_t size, }); if (rva_fetch != obj->cc_trace.m_instrs.rend()) - obj->cc_trace.m_instrs.erase((rva_fetch + 1).base(), + obj->cc_trace.m_instrs.erase(rva_fetch.base(), obj->cc_trace.m_instrs.end()); // set the virtual code block vip address information... @@ -394,7 +394,7 @@ bool emu_t::code_exec_callback(uc_engine* uc, uint64_t address, uint32_t size, uc_reg_read(uc, vm::instrs::reg_map[obj->cc_trace.m_vip], &vip_addr); obj->cc_blk->m_vip.rva = vip_addr -= obj->m_vm->m_module_base; - obj->cc_blk->m_vip.img_based = vip_addr += obj->m_vm->m_image_base; + obj->cc_blk->m_vip.img_based = obj->cc_blk->m_vip.rva += obj->m_vm->m_image_base; uc_context_restore(uc, backup); uc_context_free(backup);