sim/arm: Prevent NULL pointer dereference in sim_create_inferior.
authorWill Newton <will.newton@linaro.org>
Tue, 29 Oct 2013 16:20:48 +0000 (09:20 -0700)
committerWill Newton <will.newton@linaro.org>
Thu, 7 Nov 2013 16:02:41 +0000 (16:02 +0000)
2013-11-07  Will Newton  <will.newton@linaro.org>

PR gdb/9195
* arm/wrapper.c (sim_create_inferior): Avoid calling
bfd_get_mach with a NULL bfd.

sim/ChangeLog
sim/arm/wrapper.c

index 0060f81fd6ea6cf69fb2803bf709f9bec6a6b708..bad626f99c9d9a23c7a921253537a5bfcd355a6b 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-07  Will Newton  <will.newton@linaro.org>
+
+       PR gdb/9195
+       * arm/wrapper.c (sim_create_inferior): Avoid calling
+       bfd_get_mach with a NULL bfd.
+
 2013-06-21  Nick Clifton  <nickc@redhat.com>
 
        * msp430: New Directory.
index a4b76835a5044d7e0c0c4927aaed670d9d2de39e..cf10e782a1f27c2fea2612aa0460cb54afaec5a6 100644 (file)
@@ -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)
     {
This page took 0.027063 seconds and 4 git commands to generate.