1
0
mirror of https://github.com/bitdefender/bddisasm.git synced 2024-12-27 00:18:07 +00:00

bdshemu: Fix edge case with unsupported instrs

Fixes https://github.com/bitdefender/bddisasm/issues/106
This commit is contained in:
Eugen Podrug 2024-09-23 16:47:52 +02:00
parent b67fd766a1
commit 7136b64c6c

View File

@ -1793,13 +1793,6 @@ ShemuX86Emulate(
nd_memzero(&dst, sizeof(dst));
nd_memzero(&src, sizeof(src));
// The stop flag has been set, this means we've reached a valid instruction, but that instruction cannot be
// emulated (for example, SYSCALL, INT, system instructions, etc).
if (stop)
{
return SHEMU_ABORT_CANT_EMULATE;
}
// If we already have a detection and we wish to stop on detections, do so now.
if ((0 != Context->Flags) && (0 != (Context->Options & SHEMU_OPT_STOP_ON_EXPLOIT)))
{
@ -1942,7 +1935,7 @@ ShemuX86Emulate(
}
}
continue;
goto post_emulate;
}
// This flag can only be set for APX instructions.
@ -3557,6 +3550,14 @@ check_far_branch:
break;
}
post_emulate:
// The stop flag has been set, this means we've reached a valid instruction, but that instruction cannot be
// emulated (for example, SYSCALL, INT, system instructions, etc).
if (stop)
{
return SHEMU_ABORT_CANT_EMULATE;
}
}
// Minimum percent of the instructions were NOPs => consider we have a NOP sled. Note that we get here only if