This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1001490] C99 snprintf() does not include terminated null in truncated strings


Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001490

--- Comment #8 from Bernd Edlinger <bernd.edlinger@hotmail.de> 2012-08-09 11:00:15 BST ---
(In reply to comment #7)
Sergei,

> > This function needs 816 bytes on the stack,
> > even if you do not use any %f formats!
> > 
> > Maybe reducing this number could be worth the effort.
> Even if CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT is not defined?                 

hmm, thats funny.....

Without that define it is only 152 bytes.
That is 664 bytes difference.
BUT #define BUF changes only from 40 to 326.

Incredible, but I think I can reduce this easily:
cvt(), round(), and exponent() are all inlined.
However, char expbuf[MAXEXP] is 308 bytes!!!

but the largest possible exponent, "308", needs 3 only bytes.
Good you asked about that. Thanks!

This will reduce the stack use by 305 bytes.


> Bernd, could you, please, prepare the patch on 0-padding with ChangeLog         
> entry?  It seems to me the patch can be submitted for bug #20804               
> record.
> Thank you,
> Sergei

Ok, I am going to fix that stack issue too, and if you do not mind,
I'd also like to fix the %g issue [Bug #1001628] and submit a cumulative
patch at [Bug #20804].

Thanks,
Bernd.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]