From d15e31011229e41bd1a2b09c5e8083ca1d650c22 Mon Sep 17 00:00:00 2001 From: Catena cyber <35799796+catenacyber@users.noreply.github.com> Date: Tue, 5 Jun 2018 08:03:55 +0200 Subject: [PATCH] Fix integer overflow on systemz (#1164) using fixed function from SStream.c --- arch/SystemZ/SystemZInstPrinter.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/arch/SystemZ/SystemZInstPrinter.c b/arch/SystemZ/SystemZInstPrinter.c index 87bd2de1..052b1362 100644 --- a/arch/SystemZ/SystemZInstPrinter.c +++ b/arch/SystemZ/SystemZInstPrinter.c @@ -240,17 +240,7 @@ static void printS32ImmOperand(MCInst *MI, int OpNum, SStream *O) int32_t Value = (int32_t)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); // assert(isInt<32>(Value) && "Invalid s32imm argument"); - if (Value >= 0) { - if (Value > HEX_THRESHOLD) - SStream_concat(O, "0x%x", Value); - else - SStream_concat(O, "%u", Value); - } else { - if (Value < -HEX_THRESHOLD) - SStream_concat(O, "-0x%x", -Value); - else - SStream_concat(O, "-%u", -Value); - } + printInt32(O, Value); if (MI->csh->detail) { MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_IMM;