From: Will Newton Date: Tue, 29 Oct 2013 16:20:48 +0000 (-0700) Subject: sim/arm: Prevent NULL pointer dereference in sim_create_inferior. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8782aa321e1bb466012a71791b8a40e2cb42d841;p=binutils-gdb.git sim/arm: Prevent NULL pointer dereference in sim_create_inferior. 2013-11-07 Will Newton PR gdb/9195 * arm/wrapper.c (sim_create_inferior): Avoid calling bfd_get_mach with a NULL bfd. --- diff --git a/sim/ChangeLog b/sim/ChangeLog index 0060f81fd6e..bad626f99c9 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,9 @@ +2013-11-07 Will Newton + + PR gdb/9195 + * arm/wrapper.c (sim_create_inferior): Avoid calling + bfd_get_mach with a NULL bfd. + 2013-06-21 Nick Clifton * msp430: New Directory. diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index a4b76835a50..cf10e782a1f 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -244,11 +244,15 @@ sim_create_inferior (sd, abfd, argv, env) char **arg; if (abfd != NULL) - ARMul_SetPC (state, bfd_get_start_address (abfd)); + { + ARMul_SetPC (state, bfd_get_start_address (abfd)); + mach = bfd_get_mach (abfd); + } else - ARMul_SetPC (state, 0); /* ??? */ - - mach = bfd_get_mach (abfd); + { + ARMul_SetPC (state, 0); /* ??? */ + mach = 0; + } switch (mach) {