From 34fe53e8564dc40e31419f7fd3d8964d56978179 Mon Sep 17 00:00:00 2001 From: Eugen Podrug Date: Mon, 23 Sep 2024 16:47:52 +0200 Subject: [PATCH] bdshemu: Fix edge case with unsupported instrs Fixes https://github.com/bitdefender/bddisasm/issues/106 --- bdshemu/bdshemu_x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bdshemu/bdshemu_x86.c b/bdshemu/bdshemu_x86.c index ee18b94..329fc92 100644 --- a/bdshemu/bdshemu_x86.c +++ b/bdshemu/bdshemu_x86.c @@ -1797,7 +1797,7 @@ ShemuX86Emulate( // emulated (for example, SYSCALL, INT, system instructions, etc). if (stop) { - return SHEMU_ABORT_CANT_EMULATE; + break; } // If we already have a detection and we wish to stop on detections, do so now. @@ -3568,5 +3568,5 @@ ShemuX86Emulate( Context->Flags |= SHEMU_FLAG_NOP_SLED; } - return SHEMU_SUCCESS; + return stop ? SHEMU_ABORT_CANT_EMULATE : SHEMU_SUCCESS; }