Commit 02f90402 authored by Tor Didriksen's avatar Tor Didriksen

Bug#14039955 RPAD FUNCTION LEADS TO UNINITIALIZED VALUES WARNING IN MY_STRTOD

Rewrite the "parser" in my_strtod_int() to avoid
reading past the end of the input string.
parent b4ffce10
...@@ -1416,20 +1416,27 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s ...@@ -1416,20 +1416,27 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s
c= *++s; c= *++s;
if (!nd) if (!nd)
{ {
for (; s < end && c == '0'; c= *++s) for (; s < end; ++s)
{
c= *s;
if (c != '0')
break;
nz++; nz++;
}
if (s < end && c > '0' && c <= '9') if (s < end && c > '0' && c <= '9')
{ {
s0= s; s0= s;
nf+= nz; nf+= nz;
nz= 0; nz= 0;
goto have_dig;
} }
else
goto dig_done; goto dig_done;
} }
for (; s < end && c >= '0' && c <= '9'; c = *++s) for (; s < end; ++s)
{ {
have_dig: c= *s;
if (c < '0' || c > '9')
break;
/* /*
Here we are parsing the fractional part. Here we are parsing the fractional part.
We can stop counting digits after a while: the extra digits We can stop counting digits after a while: the extra digits
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment