public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim/arm: Prevent NULL pointer dereference in sim_create_inferior.
@ 2013-10-29 22:55 Will Newton
  2013-11-07 15:22 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Will Newton @ 2013-10-29 22:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Patch Tracking


2013-10-30  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/arm/wrapper.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index a4b7683..cf10e78 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)
     {
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sim/arm: Prevent NULL pointer dereference in sim_create_inferior.
  2013-10-29 22:55 [PATCH] sim/arm: Prevent NULL pointer dereference in sim_create_inferior Will Newton
@ 2013-11-07 15:22 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2013-11-07 15:22 UTC (permalink / raw)
  To: Will Newton; +Cc: gdb-patches, Patch Tracking

>>>>> "Will" == Will Newton <will.newton@linaro.org> writes:

Will> 2013-10-30  Will Newton  <will.newton@linaro.org>

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

Ok.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-07 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-29 22:55 [PATCH] sim/arm: Prevent NULL pointer dereference in sim_create_inferior Will Newton
2013-11-07 15:22 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).