From 8bc44ae14586c2dc1936b76c149b3281583d29ce Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 26 Aug 2024 17:28:32 +0300 Subject: [PATCH] Only call ND_SIGN_EX when instruction has displacement --- bddisasm/bdx86_decoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bddisasm/bdx86_decoder.c b/bddisasm/bdx86_decoder.c index 31f3ac8..d024910 100644 --- a/bddisasm/bdx86_decoder.c +++ b/bddisasm/bdx86_decoder.c @@ -1298,7 +1298,7 @@ NdParseMemoryOperand16( // Store the displacement. Operand->Info.Memory.HasDisp = !!Instrux->HasDisp; Operand->Info.Memory.DispSize = Instrux->DispLength; - Operand->Info.Memory.Disp = ND_SIGN_EX(Instrux->DispLength, Instrux->Displacement); + Operand->Info.Memory.Disp = Instrux->HasDisp ? ND_SIGN_EX(Instrux->DispLength, Instrux->Displacement) : 0; return ND_STATUS_SUCCESS; } @@ -1416,7 +1416,7 @@ NdParseMemoryOperand3264( Operand->Info.Memory.HasDisp = Instrux->HasDisp; Operand->Info.Memory.DispSize = Instrux->DispLength; - Operand->Info.Memory.Disp = ND_SIGN_EX(Instrux->DispLength, Instrux->Displacement); + Operand->Info.Memory.Disp = Instrux->HasDisp ? ND_SIGN_EX(Instrux->DispLength, Instrux->Displacement) : 0; return ND_STATUS_SUCCESS; }