From: Sergio Durigan Junior <sergiodj@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [patch] Fix crash in read_pe_exported_syms
Date: Sun, 03 Mar 2013 22:53:00 -0000 [thread overview]
Message-ID: <m36218yu1s.fsf@redhat.com> (raw)
In-Reply-To: <20130302110216.GA6765@calimero.vinschen.de> (Corinna Vinschen's message of "Sat, 2 Mar 2013 12:02:16 +0100")
On Saturday, March 02 2013, Corinna Vinschen wrote:
> Hi,
Hi Corinna,
> when running GDB from current CVS on a PE/COFF target, and if this
> target has no debug symbols, nor any exported symbols, then GDB crashes
> with a SEGV in the first do_cleanup called from coff_symfile_read.
>
> The reason is that read_pe_exported_syms creates two cleanup handlers,
> one of them referring to a symbol on the local stack:
>
> struct read_pe_section_data *section_data;
> [...]
> section_data = xzalloc (...)
> make_cleanup (free_current_contents, §ion_data);
>
> but then returns from the function early in three different scenarios
> without calling do_cleanup. The subsequent do_cleanup call in
> coff_symfile_read now tries to dereference from an invalid stack address
> and ultimately crashes.
>
> Below is a patch. Ok to apply?
[I am not a maintainer.]
You are right, the function returns without taking care of the possible
cleanups. IMO the patch is almost obvious, but thanks anyway for
sending it here.
I don't want to create a flamewar here, but ISTR that the use of `goto'
is discouraged in GDB/GNU. I remember I submitted a patch once that
made use of `goto' in a similar way that you are doing here, and I was
asked to rewrite it.
Anyway, recently I faced a similar issue (i.e., having to call
`do_cleanup' in several places, and what I did was to actually call it
in all those places instead of using `goto'. You might want to wait
until a global maintainer emits some opinion about this.
Thanks,
--
Sergio
next prev parent reply other threads:[~2013-03-03 22:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-02 11:02 Corinna Vinschen
2013-03-02 15:31 ` Pierre Muller
2013-03-03 23:06 ` Sergio Durigan Junior
2013-03-03 22:53 ` Sergio Durigan Junior [this message]
2013-03-04 13:24 ` Pedro Alves
2013-03-04 14:35 ` Corinna Vinschen
2013-03-04 14:41 ` Joel Brobecker
2013-03-04 15:10 ` Corinna Vinschen
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=m36218yu1s.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=gdb-patches@sourceware.org \
/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