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 <borneo.antonio@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
__archive__
Antonio Borneo 2009-12-31 02:43:56 +08:00 committed by David Brownell
parent c116d8f6bc
commit 17fb7ead4b
1 changed files with 6 additions and 0 deletions

View File

@ -834,6 +834,12 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command)
struct reg *vector_catch; struct reg *vector_catch;
uint32_t vector_catch_value; 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 */ /* it's uncommon, but some ARM7 chips can support this */
if (arm7_9->common_magic != ARM7_9_COMMON_MAGIC if (arm7_9->common_magic != ARM7_9_COMMON_MAGIC
|| !arm7_9->has_vector_catch) { || !arm7_9->has_vector_catch) {