Skip to content

Commit

Permalink
Fix #463: Wrong target offset calculated when using bnd prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed Nov 26, 2023
1 parent 157bca8 commit 4a64a63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -4373,7 +4373,8 @@ ZYDIS_EXPORT ZyanStatus ZydisEncoderEncodeInstructionAbsolute(ZydisEncoderReques
}
if ((rel_info->accepts_branch_hints) &&
(request->prefixes & (ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN |
ZYDIS_ATTRIB_HAS_BRANCH_TAKEN)))
ZYDIS_ATTRIB_HAS_BRANCH_TAKEN |
ZYDIS_ATTRIB_HAS_BND)))
{
extra_length = 1;
}
Expand Down
1 change: 1 addition & 0 deletions tools/ZydisTestEncoderAbsolute.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ static ZyanBool RunBranchingTests(void)
static const ZydisInstructionAttributes prefixes[] = {
0,
ZYDIS_ATTRIB_HAS_BRANCH_TAKEN,
ZYDIS_ATTRIB_HAS_BND,
};
static const char *str_prefixes[] =
{
Expand Down

0 comments on commit 4a64a63

Please sign in to comment.