From 6fa4c5a456e27ed1446b08a590c0494199c95c8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Harboe?= Date: Sat, 5 Nov 2011 13:13:50 +0100 Subject: [PATCH] disassembly: fix access to undefined memory pointer upon unknown instruction MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/target/arm_disassembler.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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, -- 2.39.5