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.
This commit is contained in:
parent
65fb9e0f84
commit
18fec1e9c1
@ -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;
|
|
||||||
}
|
}
|
||||||
goto dig_done;
|
else
|
||||||
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user