Skip to content

Commit 4a64a63

Browse files
committed
Fix zyantific#463: Wrong target offset calculated when using bnd prefix
1 parent 157bca8 commit 4a64a63

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Encoder.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -4373,7 +4373,8 @@ ZYDIS_EXPORT ZyanStatus ZydisEncoderEncodeInstructionAbsolute(ZydisEncoderReques
43734373
}
43744374
if ((rel_info->accepts_branch_hints) &&
43754375
(request->prefixes & (ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN |
4376-
ZYDIS_ATTRIB_HAS_BRANCH_TAKEN)))
4376+
ZYDIS_ATTRIB_HAS_BRANCH_TAKEN |
4377+
ZYDIS_ATTRIB_HAS_BND)))
43774378
{
43784379
extra_length = 1;
43794380
}

tools/ZydisTestEncoderAbsolute.c

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ static ZyanBool RunBranchingTests(void)
224224
static const ZydisInstructionAttributes prefixes[] = {
225225
0,
226226
ZYDIS_ATTRIB_HAS_BRANCH_TAKEN,
227+
ZYDIS_ATTRIB_HAS_BND,
227228
};
228229
static const char *str_prefixes[] =
229230
{

0 commit comments

Comments
 (0)