Hello,
A little fix fpr utils_strtod. It should use integer if it needs to test values lower than 0 (<= 0 incl.). A better fix would be to use the start address :)
Patch again svn head attached (with some other sanity checks).
Cheers, --Pierre
On Mon, 22 May 2006 01:19:08 +0200, Pierre pierre.php@gmail.com wrote:
Hello,
Hi,
A little fix fpr utils_strtod. It should use integer if it needs to test values lower than 0 (<= 0 incl.). A better fix would be to use
when gets i lower than 0? I think unsigned int is ok. When i is lower than 0, there must be a bigger problem than the integer underflow ;-). (correct me if I'm wrong) The sanity check for source == NULL is good and applied.
The checks for foreground and background are ok and I'll commit them.
Thanks.
regards, Enrico
On 5/22/06, Enrico Tröger enrico.troeger@uvena.de wrote:
On Mon, 22 May 2006 01:19:08 +0200, Pierre pierre.php@gmail.com wrote:
Hello,
Hi,
A little fix fpr utils_strtod. It should use integer if it needs to test values lower than 0 (<= 0 incl.). A better fix would be to use
when gets i lower than 0? I think unsigned int is ok. When i is lower than 0, there must be a bigger problem than the integer underflow ;-). (correct me if I'm wrong)
It always crashes here. You cannot compare a value lower than 0 (>=0 may end to <0) if you use a unsigned integer. It may work in many cases and be evaluated as true in many other (like in some 64bits system + gcc).
I can give you another version which does not use any integer but decrement the pointer until it reaches the beginning of string, it is safe and platform independent.
--Pierre
On Mon, 22 May 2006 01:57:50 +0200, Pierre pierre.php@gmail.com wrote:
On 5/22/06, Enrico Tröger enrico.troeger@uvena.de wrote:
On Mon, 22 May 2006 01:19:08 +0200, Pierre pierre.php@gmail.com wrote:
Hello,
Hi,
A little fix fpr utils_strtod. It should use integer if it needs to test values lower than 0 (<= 0 incl.). A better fix would be to use
when gets i lower than 0? I think unsigned int is ok. When i is lower than 0, there must be a bigger problem than the integer underflow ;-). (correct me if I'm wrong)
It always crashes here. You cannot compare a value lower than 0 (>=0 may end to <0) if you use a unsigned integer. It may work in many
This convinced me. Ok, now it is a signed integer.
I can give you another version which does not use any integer but decrement the pointer until it reaches the beginning of string, it is safe and platform independent.
Even better. I just wrote this down to the TODO list, but I you have already the code, it would be nice to see it.
regards, Enrico
On 5/22/06, Enrico Tröger enrico.troeger@uvena.de wrote:
On Mon, 22 May 2006 01:19:08 +0200, Pierre pierre.php@gmail.com wrote:
Hello,
Hi,
A little fix fpr utils_strtod. It should use integer if it needs to test values lower than 0 (<= 0 incl.). A better fix would be to use
when gets i lower than 0? I think unsigned int is ok. When i is lower than 0, there must be a bigger problem than the integer underflow ;-). (correct me if I'm wrong)
I sent my reply too early. Here is a little example (values of i using 6 chars): 5 4 3 2 1 0 FFFFFFFF
The last line would actually be "-1" but it is not. It is out of the int range, on many platform it will be seen as a positive integer.
I hope I'm more clear now :)
Cheers, --Pierre