[Geany] utils_strtod, invalid_test + patch

Pierre pierre.php at xxxxx
Sun May 21 23:57:50 UTC 2006


On 5/22/06, Enrico Tröger <enrico.troeger at uvena.de> wrote:
> On Mon, 22 May 2006 01:19:08 +0200, Pierre <pierre.php at 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



More information about the Users mailing list