Skip to content

Commit

Permalink
Minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Nov 4, 2024
1 parent d8aee19 commit 10cf4b3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/Zydis/FormatterBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ typedef const ZydisFormatterToken ZydisFormatterTokenConst;
typedef struct ZydisFormatterBuffer_
{
/**
* `ZYAN_TRUE`, if the buffer contains a token stream or `ZYAN_FALSE, if it
* `ZYAN_TRUE`, if the buffer contains a token stream or `ZYAN_FALSE`, if it
* contains a simple string.
*/
ZyanBool is_token_list;
Expand Down
4 changes: 3 additions & 1 deletion src/Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -4315,7 +4315,9 @@ static ZyanStatus ZydisNodeHandlerRexB(const ZydisDecoderContext* context,
default:
ZYAN_UNREACHABLE;
}
*index = context->vector_unified.B3;

*index = context->vector_unified.B3 + context->vector_unified.B4 ? 1 : 0;

return ZYAN_STATUS_SUCCESS;
}

Expand Down
3 changes: 2 additions & 1 deletion src/FormatterATT.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ ZyanStatus ZydisFormatterATTFormatInstruction(const ZydisFormatter* formatter,
ZyanUPointer state_mnemonic;
ZYDIS_BUFFER_REMEMBER(buffer, state_mnemonic);

if (formatter->deco_apx_dfv_use_immediate)
if (formatter->deco_apx_dfv_use_immediate && (context->instruction->apx.scc != ZYDIS_SCC_NONE))
{
ZYDIS_BUFFER_APPEND(buffer, DELIM_MNEMONIC);
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
ZYDIS_BUFFER_APPEND(buffer, IMMEDIATE);
ZYAN_CHECK(ZydisStringAppendDecU(&buffer->string,
context->instruction->apx.default_flags, 0,
Expand Down
2 changes: 1 addition & 1 deletion src/FormatterIntel.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ZyanStatus ZydisFormatterIntelFormatInstruction(const ZydisFormatter* formatter,
ZyanUPointer state_mnemonic;
ZYDIS_BUFFER_REMEMBER(buffer, state_mnemonic);

if (formatter->deco_apx_dfv_use_immediate)
if (formatter->deco_apx_dfv_use_immediate && (context->instruction->apx.scc != ZYDIS_SCC_NONE))
{
ZYDIS_BUFFER_APPEND(buffer, DELIM_MNEMONIC);
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
Expand Down

0 comments on commit 10cf4b3

Please sign in to comment.