public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@freebsd.org>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <palves@redhat.com>
Subject: Re: [PATCH] xml_fetch_content_from_file: Read in whole file in one go (Re: [pushed] Fix double-free corruption)
Date: Wed, 18 Oct 2017 22:30:00 -0000	[thread overview]
Message-ID: <2811735.d9V1pPNBEL@ralph.baldwin.cx> (raw)
In-Reply-To: <199a50c3-4f55-c40e-7dcf-47db0ef27798@redhat.com>

On Tuesday, October 17, 2017 01:20:14 PM Pedro Alves wrote:
> On 10/17/2017 12:41 PM, Pedro Alves wrote:
> > Fixes a double-free regression introduced by commit b7b030adc405
> > ("Return unique_xmalloc_ptr from target_read_stralloc"):
> > 
> > gdb.sum:
> >   Running src/gdb/testsuite/gdb.base/catch-syscall.exp ...
> >   ERROR: Process no longer exists
> > 
> 
> 
> ...
> 
> 
> > The problem is that if xrealloc decides it needs a new memory block,
> > it frees the previous block/pointer, and then text.reset() frees it
> > again.
> 
> Looking a bit deeper, I can't seem to find a reason this code is
> reading in chunks in the first place?  Why not read it all in one
> go?  Like patch below.

Seems sensible.  It's unlikely that an XML file will be stored directly
on a tape such that seek() is non-optimal. :)

-- 
John Baldwin

  reply	other threads:[~2017-10-18 22:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 11:42 [pushed] Fix double-free corruption Pedro Alves
2017-10-17 12:20 ` [PATCH] xml_fetch_content_from_file: Read in whole file in one go (Re: [pushed] Fix double-free corruption) Pedro Alves
2017-10-18 22:30   ` John Baldwin [this message]
2017-10-19 14:27     ` Pedro Alves

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=2811735.d9V1pPNBEL@ralph.baldwin.cx \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).