From cda40c6537547bc722efee821e32d2f7d1db53c7 Mon Sep 17 00:00:00 2001 From: R3v0LT <87137964+R33v0LT@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:46:00 +0300 Subject: [PATCH] Fix invalid comparison with HPPA_OP_INVALID (#2300) --- arch/HPPA/HPPAInstPrinter.c | 2 +- arch/HPPA/HPPAMapping.c | 2 +- bindings/python/test_hppa.py | 2 +- cstool/cstool_hppa.c | 2 +- suite/cstest/src/hppa_detail.c | 2 +- tests/test_hppa.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/HPPA/HPPAInstPrinter.c b/arch/HPPA/HPPAInstPrinter.c index 56a2ff6385..3cea32e1ca 100644 --- a/arch/HPPA/HPPAInstPrinter.c +++ b/arch/HPPA/HPPAInstPrinter.c @@ -609,7 +609,7 @@ static void print_operand(MCInst *MI, SStream *O, const cs_hppa_op *op) break; case HPPA_OP_MEM: SStream_concat(O, "("); - if (op->mem.space != HPPA_OP_INVALID && + if (op->mem.space != HPPA_REG_INVALID && op->mem.space != HPPA_REG_SR0) { SStream_concat(O, HPPA_reg_name((csh)MI->csh, op->mem.space)); diff --git a/arch/HPPA/HPPAMapping.c b/arch/HPPA/HPPAMapping.c index 75f03dc2d0..7922861c41 100644 --- a/arch/HPPA/HPPAMapping.c +++ b/arch/HPPA/HPPAMapping.c @@ -419,7 +419,7 @@ void HPPA_reg_access(const cs_insn *insn, cs_regs regs_read, } break; case HPPA_OP_MEM: - if (op->mem.space != HPPA_OP_INVALID) + if (op->mem.space != HPPA_REG_INVALID) regs_read[read_count++] = op->mem.space; if (op->mem.base_access & CS_AC_READ) { regs_read[read_count++] = op->mem.base; diff --git a/bindings/python/test_hppa.py b/bindings/python/test_hppa.py index 75fcd0c29d..15e0e6017e 100755 --- a/bindings/python/test_hppa.py +++ b/bindings/python/test_hppa.py @@ -42,7 +42,7 @@ def print_insn_detail(insn): print("\t\toperands[%u].type: DISP = 0x%s" % (c, to_x(i.imm))) if i.type == HPPA_OP_MEM: print("\t\toperands[%u].type: MEM" % c) - if i.mem.space != HPPA_OP_INVALID: + if i.mem.space != HPPA_REG_INVALID: print("\t\t\toperands[%u].mem.space: REG = %s" % (c, insn.reg_name(i.mem.space))) print("\t\t\toperands[%u].mem.base: REG = %s" % (c, insn.reg_name(i.mem.base))) if i.type == HPPA_OP_TARGET: diff --git a/cstool/cstool_hppa.c b/cstool/cstool_hppa.c index f41b843180..154b6ac873 100644 --- a/cstool/cstool_hppa.c +++ b/cstool/cstool_hppa.c @@ -51,7 +51,7 @@ void print_insn_detail_hppa(csh handle, cs_insn *ins) break; case HPPA_OP_MEM: printf("\t\toperands[%u].type: MEM\n", i); - if (op->mem.space != HPPA_OP_INVALID) { + if (op->mem.space != HPPA_REG_INVALID) { printf("\t\t\toperands[%u].mem.space: REG = %s\n", i, cs_reg_name(handle, op->mem.space)); } diff --git a/suite/cstest/src/hppa_detail.c b/suite/cstest/src/hppa_detail.c index 38bc762c08..213a73c4f9 100644 --- a/suite/cstest/src/hppa_detail.c +++ b/suite/cstest/src/hppa_detail.c @@ -48,7 +48,7 @@ char *get_detail_hppa(csh *p_handle, cs_mode mode, cs_insn *ins) break; case HPPA_OP_MEM: add_str(&result, "\t\toperands[%u].type: MEM\n", i); - if (op->mem.space != HPPA_OP_INVALID) { + if (op->mem.space != HPPA_REG_INVALID) { add_str(&result, "\t\t\toperands[%u].mem.space: REG = %s\n", i, cs_reg_name(handle, op->mem.space)); diff --git a/tests/test_hppa.c b/tests/test_hppa.c index 15a0179043..d96693cc76 100644 --- a/tests/test_hppa.c +++ b/tests/test_hppa.c @@ -64,7 +64,7 @@ static void print_insn_detail(cs_insn *ins) break; case HPPA_OP_MEM: printf("\t\toperands[%u].type: MEM\n", i); - if (op->mem.space != HPPA_OP_INVALID) { + if (op->mem.space != HPPA_REG_INVALID) { printf("\t\t\toperands[%u].mem.space: REG = %s\n", i, cs_reg_name(handle, op->mem.space)); }