out of memory in Balloc
Dave Korn
dave.korn@artimi.com
Thu Aug 3 11:35:00 GMT 2006
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....
More information about the Newlib
mailing list