From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Anthony Green <green@moxielogic.com>
Subject: [patch] [sim/moxie] Fix NULL dereferences
Date: Fri, 26 Feb 2010 12:47:00 -0000 [thread overview]
Message-ID: <20100226124738.GA6773@host0.dyn.jankratochvil.net> (raw)
Hi,
it looks as obvious to me but I know nothina about either sim or moxie.
Thanks,
Jan
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=moxie-unknown-elf".
./gdb -nx -ex 'target sim' -ex r
= crash
2010-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* interp.c (sim_create_inferior): Fix crashes on zero PROG_BFD or ARGV.
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -1307,11 +1307,12 @@ sim_create_inferior (sd, prog_bfd, argv, env)
set_initial_gprs ();
issue_messages = l;
- cpu.asregs.regs[PC_REGNO] = bfd_get_start_address (prog_bfd);
+ if (prog_bfd != NULL)
+ cpu.asregs.regs[PC_REGNO] = bfd_get_start_address (prog_bfd);
/* Copy args into target memory. */
avp = argv;
- for (argc = 0; *avp; avp++)
+ for (argc = 0; avp && *avp; avp++)
argc++;
/* Target memory looks like this:
next reply other threads:[~2010-02-26 12:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 12:47 Jan Kratochvil [this message]
2010-02-27 1:04 ` Anthony Green
2010-02-27 1:29 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100226124738.GA6773@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=green@moxielogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox