diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 8c10559cf..b4010be22 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,8 @@ +2005-02-01 Danny Smith + + * mingwex/strtold.c (__asctoe64): Set endptr to 'e' if exponent + string is not valid. + 2005-01-26 Oliver Stoeneberg * include/malloc.h: Add missing return code defines for diff --git a/winsup/mingw/mingwex/strtold.c b/winsup/mingw/mingwex/strtold.c index 954d3cb7c..3bbcea061 100644 --- a/winsup/mingw/mingwex/strtold.c +++ b/winsup/mingw/mingwex/strtold.c @@ -255,6 +255,8 @@ expnt: esign = 1; exp = 0; +/* Save position in case we need to fall back. */ +sp = s; ++s; /* check for + or - */ if( *s == '-' ) @@ -265,6 +267,13 @@ if( *s == '-' ) if( *s == '+' ) ++s; +/* Check for valid exponent. */ +if (!(*s >= '0' && *s <= '9')) + { + s = sp; + goto daldone; + } + while( (*s >= '0') && (*s <= '9') ) { /* Stop modifying exp if we are going to overflow anyway,