Skip to content

Commit

Permalink
bdshemu: Fix edge case with unsupported instrs
Browse files Browse the repository at this point in the history
  • Loading branch information
ScimitarEnjoyer committed Sep 23, 2024
1 parent 34a0880 commit 0bfbfd3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bdshemu/bdshemu_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
{
Expand Down Expand Up @@ -3557,6 +3550,13 @@ ShemuX86Emulate(

break;
}

// 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
Expand Down

0 comments on commit 0bfbfd3

Please sign in to comment.