diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/arch/immediate.c | 5 | ||||
-rw-r--r-- | src/arch/immediate.h | 3 |
3 files changed, 11 insertions, 2 deletions
@@ -1,6 +1,11 @@ 17-04-28 Cyrille Bagard <nocbos@gmail.com> * src/arch/immediate.c: + Rewrite some security checks when printing immediate values. + +17-04-28 Cyrille Bagard <nocbos@gmail.com> + + * src/arch/immediate.c: Escape some characters as needed when building tooltips. 17-04-28 Cyrille Bagard <nocbos@gmail.com> diff --git a/src/arch/immediate.c b/src/arch/immediate.c index 88426de..a6f080f 100644 --- a/src/arch/immediate.c +++ b/src/arch/immediate.c @@ -893,7 +893,7 @@ static size_t _g_imm_operand_to_string(const GImmOperand *operand, AsmSyntax syn static const char *conv_si_defs[] = { "", "o", "d", "x", "c" }; static const char *conv_us_defs[] = { "", "o", "u", "x", "c" }; - result = 0; /* Gcc... */ + assert(display <= IOD_LAST_VALID); range = MDS_RANGE(operand->size); @@ -1042,11 +1042,12 @@ static size_t _g_imm_operand_to_string(const GImmOperand *operand, AsmSyntax syn default: assert(false); + result = 0; break; } - assert(((int)result) > 0); + assert(result > 0); return result; diff --git a/src/arch/immediate.h b/src/arch/immediate.h index b4d1f84..450ceef 100644 --- a/src/arch/immediate.h +++ b/src/arch/immediate.h @@ -54,6 +54,9 @@ typedef enum _ImmOperandDisplay } ImmOperandDisplay; +#define IOD_LAST_VALID IOD_CHAR + + #define G_TYPE_IMM_OPERAND g_imm_operand_get_type() #define G_IMM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_imm_operand_get_type(), GImmOperand)) #define G_IS_IMM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_imm_operand_get_type())) |