Skip to content

Commit

Permalink
Make fuzzer aware of UD0_COMPAT mode
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Jan 25, 2024
1 parent a8c754f commit c882bc6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/ZydisFuzzEncoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@ int ZydisFuzzTarget(ZydisStreamRead read_fn, void *stream_ctx)
abort();
}

if (request.mnemonic == ZYDIS_MNEMONIC_UD0 && request.operand_count == 0)
{
status = ZydisDecoderEnableMode(&decoder, ZYDIS_DECODER_MODE_UD0_COMPAT, ZYAN_TRUE);
if (!ZYAN_SUCCESS(status))
{
fputs("Failed to enable UD0_COMPAT mode\n", ZYAN_STDERR);
abort();
}
}

ZydisDecodedInstruction insn1;
ZydisDecodedOperand operands1[ZYDIS_MAX_OPERAND_COUNT];
status = ZydisDecoderDecodeFull(&decoder, encoded_instruction, encoded_length, &insn1,
Expand Down

0 comments on commit c882bc6

Please sign in to comment.