client9 / stringencoders

Fast c-string transformations
MIT License
135 stars 51 forks source link

modp_dtoa returns crap pointer in corner cases #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. print any double that has a nan, or too big
2.
3.

The corner cases have a simple "return" and it doesn't return a char* which is 
a fatal bug.

Original issue reported on code.google.com by mbad...@gmail.com on 30 Dec 2011 at 3:07

GoogleCodeExporter commented 9 years ago
Ahhh I see.
I should store a null in the output.

Right now the function doesn't return a char*.  I can't change that without 
breaking ABI compatibility (I think).

Let me make a test case and fix will be forthcoming.

thank you!

Original comment by nickg@client9.com on 24 Feb 2012 at 5:22

GoogleCodeExporter commented 9 years ago

Original comment by nickg@client9.com on 24 Feb 2012 at 5:24

GoogleCodeExporter commented 9 years ago
Actually, I misread my own code.   The function does not return a pointer, it's 
void, so if you are using the return value, it's likely to be bogus.

 The corner cases do 'return' but also set the buffer to 'nan' or 'inf' as appropriate.

In general i think these function SHOULD return a pointer, but i can't change 
it now without breaking binary compatibility.

Thanks for your time here.  If you think I got this wrong, please reopen.

Original comment by nickg@client9.com on 26 Feb 2012 at 4:21