Clear MCInst when the decode fails, to reset operand counter.

This commit is contained in:
Rot127 2024-07-20 05:49:32 -05:00 committed by Rot127
parent dddf0d1faa
commit 90b6007454

View File

@ -1030,6 +1030,9 @@ void PrinterCapstone::decoderEmitterEmitDecodeInstruction(
<< " /* Decoding complete. */ \\\n"
<< " return S; \\\n"
<< " } else { \\\n"
<< " /* LLVM uses a MCInst on the stack, but for our use case, */ \\\n"
<< " /* it is enough for now to reset the op counter. */ \\\n"
<< " MCInst_clear(MI); \\\n"
<< " /* If the decoding was incomplete, skip. */ \\\n"
<< " Ptr += NumToSkip; \\\n"
<< " /* Reset decode status. This also drops a SoftFail status "