Problem with d2b called from sprintf
"Jim & Lori Lawrence" (jimlori@provide.net)
Tue, 6 Oct 1998 06:45:25 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_0112_01BDF0F4.E6340FE0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm using Newlib 1.8.1.
I'm having a problem with some data in low memory being overwritten when =
calling sprintf. The calling sequence is as follows:
1. Sprintf calls d2b in mprec.c=20
2. d2b calls balloc also in mprec.c
3. balloc calls calloc=20
4. calloc fails, returns a null pointer to balloc
5. balloc returns a null pointer to d2b
4. d2b uses the null pointer as the base address of a structure located =
at address zero
Apparently sprintf requires more heap space than what is available. My =
embedded system has approximately 6K bytes available for the heap. What =
are the minimum requirements for available heap space for using sprintf?
=20
------=_NextPart_000_0112_01BDF0F4.E6340FE0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#b8b8b8>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>I'm using Newlib 1.8.1.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>I'm having a problem with some data =
in low=20
memory being overwritten when calling sprintf. The calling =
sequence is as=20
follows:</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>1. Sprintf calls d2b in mprec.c =
</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>2. d2b calls balloc also in =
mprec.c</FONT></DIV>
<DIV><FONT size=3D2>3. balloc calls calloc </FONT></DIV>
<DIV><FONT size=3D2>4. calloc fails, returns a null pointer to =
balloc</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>5. balloc returns a null pointer to=20
d2b</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>4. d2b uses the null pointer as the =
base address=20
of a structure located at address zero</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>Apparently sprintf requires more =
heap space than=20
what is available. My embedded system has approximately 6K bytes =
available=20
for the heap. What are the minimum requirements for available heap =
space=20
for using sprintf?</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> </FONT></DIV></BODY></HTML>
------=_NextPart_000_0112_01BDF0F4.E6340FE0--
________________________________________________
To get help for the crossgcc list, send mail to
crossgcc-request@cygnus.com with the text 'help'
(without the quotes) in the body of the message.