x86: AT&T syntax bug with zero offset segment register. see #884
diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c
index f408668..a28ddf8 100644
--- a/arch/X86/X86ATTInstPrinter.c
+++ b/arch/X86/X86ATTInstPrinter.c
@@ -746,7 +746,7 @@
MCOperand *DispSpec = MCInst_getOperand(MI, Op + X86_AddrDisp);
MCOperand *SegReg = MCInst_getOperand(MI, Op + X86_AddrSegmentReg);
uint64_t ScaleVal;
- int reg;
+ int segreg;
if (MI->csh->detail) {
uint8_t access[6];
@@ -764,11 +764,11 @@
}
// If this has a segment register, print it.
- reg = MCOperand_getReg(SegReg);
- if (reg) {
+ segreg = MCOperand_getReg(SegReg);
+ if (segreg) {
_printOperand(MI, Op + X86_AddrSegmentReg, O);
if (MI->csh->detail) {
- MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = reg;
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = segreg;
}
SStream_concat0(O, ":");
@@ -803,7 +803,8 @@
}
}
} else {
- //SStream_concat0(O, "0");
+ if (segreg)
+ SStream_concat0(O, "0");
}
}