This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: out of memory in Balloc
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Joern RENNECKE'" <joern dot rennecke at st dot com>, <newlib at sourceware dot org>
- Date: Wed, 2 Aug 2006 20:21:25 +0100
- Subject: RE: out of memory in Balloc
On 01 August 2006 16:21, Joern RENNECKE wrote:
> When mprec.c, dtoa.c or strtod.c, ldtoa.c or gdtoa-gethex.c calls
> balloc, it does not check the return value.
> Thus, when we run out of memory, and memory at 0 can be accessed, the
> program will run on for a while
> and later fail with an obscure failure.
> I'm not sure how to best handle this - should we call abort then, or
> would this cause to much other code to
> be dragged in? If the latter is the case, then I think an infinite
> loops is still better than memory corruption.
>
> Since none of the callers to Balloc in newlib checks the return value, I
> suppose an abort call, if any, should
> be placed in Balloc instead of returning NULL there.
How about raising a SEGV? newlib supplies kill(..), doesn't it? Hmmm, but
it's probably a stub on lots of arches. Some way of raising SEGV if it's
possible and falling back to abort() if it isn't, perhaps?
cheers,
DaveK
--
Can't think of a witty .sigline today....