printf bug

David Shmelzer daves@pmdcorp.com
Fri Jan 22 22:02:00 GMT 2010


Hi,

The *may* be a bug in printf.

printf() does not return an error when printing a floating point value
when there is no heap left.

The library source file, dtoa.c, does not check for a NULL return value
of the malloc call as shown here:

  _REENT_MP_RESULT(ptr) = Balloc (ptr, _REENT_MP_RESULT_K(ptr));
  s = s0 = (char *) _REENT_MP_RESULT(ptr);

  ... s and s0 are not checked before used.

Dave



More information about the Newlib mailing list