[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dumper issue, revisited; invalid realloc/free
From: |
Rich Felker |
Subject: |
Re: Dumper issue, revisited; invalid realloc/free |
Date: |
Wed, 4 Feb 2015 14:13:05 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Feb 04, 2015 at 09:08:00PM +0200, Eli Zaretskii wrote:
> > Date: Wed, 4 Feb 2015 12:57:09 -0500
> > From: Rich Felker <address@hidden>
> >
> > The simplest solution I can find is to make the affected free
> > functions (xrealloc, xfree, lisp_free, and lisp_align_free) check
> > whether their argument is in the range of data_start...initial_brk and
> > act as a nop (or in the case of xrealloc, allocate a new object
> > without freeing the old one) when this is the case. The check is
> > easily accomplished by saving initial_brk=sbrk(0) at startup (to be
> > lazy I did this with attribute((constructor)) but other approaches
> > might be preferred for an upstream fix. For xrealloc, since the old
> > size is not known, I simply estimate it as initial_brk-block. Copying
> > up to the min or this value and the new size should be safe, anyway.
> >
> > Does this sound acceptable for upstream?
>
> Yes. Several platforms (Cygwin and MinGW on MS-Windows) already do
> exactly that.
Where is the code that does this? I don't see it in alloc.c. Is it
only used when system_malloc=no? The case where it's really needed is
for system_malloc=yes...
Rich
- Dumper issue, revisited; invalid realloc/free, Rich Felker, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free, Eli Zaretskii, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free,
Rich Felker <=
- Re: Dumper issue, revisited; invalid realloc/free, Eli Zaretskii, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free, Eli Zaretskii, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free, Ken Brown, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free, Rich Felker, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free, Rich Felker, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free, Eli Zaretskii, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free, Rich Felker, 2015/02/04
- Re: Dumper issue, revisited; invalid realloc/free, Wolfgang Jenkner, 2015/02/05
- Re: Dumper issue, revisited; invalid realloc/free, Rich Felker, 2015/02/05
Re: Dumper issue, revisited; invalid realloc/free, Eli Zaretskii, 2015/02/04