Fixed a bug that caused the formatter to falsely print a `{sae}` decorator in some cases

This commit is contained in:
flobernd 2017-07-25 14:58:17 +02:00
parent 7434bea839
commit cde97dca36
1 changed files with 11 additions and 13 deletions

View File

@ -756,8 +756,11 @@ static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisFormatter* forma
} }
break; break;
case ZYDIS_DECORATOR_TYPE_SAE: case ZYDIS_DECORATOR_TYPE_SAE:
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer, if (instruction->avx.hasSAE && !instruction->avx.roundingMode)
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {sae}")); {
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer,
ZYDIS_STRBUF_APPEND_MODE_DEFAULT, " {sae}"));
}
break; break;
case ZYDIS_DECORATOR_TYPE_SWIZZLE: case ZYDIS_DECORATOR_TYPE_SWIZZLE:
switch (instruction->avx.swizzleMode) switch (instruction->avx.swizzleMode)
@ -948,17 +951,12 @@ static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatte
bufEnd - *buffer, instruction, &instruction->operands[i], bufEnd - *buffer, instruction, &instruction->operands[i],
ZYDIS_DECORATOR_TYPE_SWIZZLE)); ZYDIS_DECORATOR_TYPE_SWIZZLE));
} }
if (instruction->avx.roundingMode) ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, buffer,
{ bufEnd - *buffer, instruction, &instruction->operands[i],
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, buffer, ZYDIS_DECORATOR_TYPE_ROUNDING_CONTROL));
bufEnd - *buffer, instruction, &instruction->operands[i], ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, buffer,
ZYDIS_DECORATOR_TYPE_ROUNDING_CONTROL)); bufEnd - *buffer, instruction, &instruction->operands[i],
} else ZYDIS_DECORATOR_TYPE_SAE));
{
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, buffer,
bufEnd - *buffer, instruction, &instruction->operands[i],
ZYDIS_DECORATOR_TYPE_SAE));
}
} }
} }
} }