From: Øyvind Harboe Date: Sat, 5 Nov 2011 12:13:50 +0000 (+0100) Subject: disassembly: fix access to undefined memory pointer upon unknown instruction X-Git-Tag: v0.6.0-rc1~450 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6fa4c5a456e27ed1446b08a590c0494199c95c8a;p=openocd disassembly: fix access to undefined memory pointer upon unknown instruction return error message instead. Found by clang. Change-Id: Ica109d077206236a12d007e77cc78061ffd05834 Signed-off-by: Øyvind Harboe Reviewed-on: http://openocd.zylin.com/169 Tested-by: jenkins Reviewed-by: Spencer Oliver --- diff --git a/src/target/arm_disassembler.c b/src/target/arm_disassembler.c index 36566c99..188b6ba7 100644 --- a/src/target/arm_disassembler.c +++ b/src/target/arm_disassembler.c @@ -280,13 +280,13 @@ static int evaluate_ldc_stc_mcrr_mrrc(uint32_t opcode, { instruction->type = ARM_MCRR; mnemonic = "MCRR"; - } - - /* MRRC */ - if ((opcode & 0x0ff00000) == 0x0c500000) - { + } else if ((opcode & 0x0ff00000) == 0x0c500000) { + /* MRRC */ instruction->type = ARM_MRRC; mnemonic = "MRRC"; + } else { + LOG_ERROR("Unknown instruction"); + return ERROR_FAIL; } snprintf(instruction->text, 128,