emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dumper issue, revisited; invalid realloc/free


From: Eli Zaretskii
Subject: Re: Dumper issue, revisited; invalid realloc/free
Date: Wed, 04 Feb 2015 21:08:00 +0200

> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]