From 17fb7ead4b901f10c01c0824f594d91775b012b3 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Thu, 31 Dec 2009 02:43:56 +0800 Subject: [PATCH] ARM9TDMI: Fix segfault. The handler for "arm9tdmi vector_catch ..." did not check if target has already been examined. Without this fix it segfaults when using NULL pointer "arm7_9->eice_cache". Signed-off-by: Antonio Borneo Signed-off-by: David Brownell --- src/target/arm9tdmi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 0e99cd1e..ae0c4e05 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -834,6 +834,12 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) struct reg *vector_catch; uint32_t vector_catch_value; + if (!target_was_examined(target)) + { + LOG_ERROR("Target not examined yet"); + return ERROR_FAIL; + } + /* it's uncommon, but some ARM7 chips can support this */ if (arm7_9->common_magic != ARM7_9_COMMON_MAGIC || !arm7_9->has_vector_catch) { -- 2.39.5