From: Simon Marchi <simark@simark.ca>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org, gdb-patches@sourceware.org
Subject: Re: PR25993, read of freed memory
Date: Tue, 19 May 2020 20:19:08 -0400 [thread overview]
Message-ID: <6de2c911-78b4-4a8e-6b40-5166211ee07a@simark.ca> (raw)
In-Reply-To: <20200519234014.GA16809@bubble.grove.modra.org>
On 2020-05-19 7:40 p.m., Alan Modra wrote:
> On Tue, May 19, 2020 at 09:27:15AM -0400, Simon Marchi wrote:
>> On 2020-05-19 12:32 a.m., Alan Modra via Gdb-patches wrote:
>>> -void bfd_set_filename (bfd *abfd, char *filename);
>>> +char *bfd_set_filename (bfd *abfd, const char *filename);
>> Should this return a `const char *`, just like bfd_get_filename?
>>
>> I haven't inspected all call sites, but it sounds like the caller
>> shouldn't be able to modify the filename contents.
> Yes, I've updated the return type. One minor change needed to
> mach-o.c.
>
>> Since the string gets copied by bfd_set_filename, let's use std::string
>> to avoid having to free:
> Done, and symfile-mem.c updated as per down-thread suggestion to make
> name a const char*.
>
> I've left the return status from bfd_set_filename in gdb unchecked,
> ie. the out-of-memory NULL return, since it seems to me that not
> getting the expected name change is a minor detail very likely to be
> lost in some later OOM.
That LGTM for the GDB side, but I get a build failure in bfd/archive.c. I think
bfd-in2.h needs to be regenerated? Or maybe in BFD you don't typically include
re-generated files in your patches?
Simon
next prev parent reply other threads:[~2020-05-20 0:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 4:32 Alan Modra
2020-05-19 13:27 ` Simon Marchi
2020-05-19 17:25 ` Christian Biesinger
2020-05-19 17:26 ` Simon Marchi
2020-05-19 18:58 ` Christian Biesinger
2020-05-19 19:37 ` Pedro Alves
2020-05-19 19:38 ` Simon Marchi
2020-05-19 23:40 ` Alan Modra
2020-05-20 0:19 ` Simon Marchi [this message]
2020-05-20 1:51 ` Alan Modra
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=6de2c911-78b4-4a8e-6b40-5166211ee07a@simark.ca \
--to=simark@simark.ca \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--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