summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2012-05-18 12:57:38 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2012-05-18 12:57:38 +0200
commit18fec1e9c1eeaf2f598b98aa764c161fee1f91d9 (patch)
tree4cdc4ef02aa465177482c7cc59eb6ec066d0adb3 /strings
parent65fb9e0f845d8b93f23a61a79bc0e30edd52acaa (diff)
downloadmariadb-git-18fec1e9c1eeaf2f598b98aa764c161fee1f91d9.tar.gz
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.
Diffstat (limited to 'strings')
-rw-r--r--strings/dtoa.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/strings/dtoa.c b/strings/dtoa.c
index ef1c141ec44..4086bf412fe 100644
--- a/strings/dtoa.c
+++ b/strings/dtoa.c
@@ -1416,20 +1416,27 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s
c= *++s;
if (!nd)
{
- for (; s < end && c == '0'; c= *++s)
+ for (; s < end; ++s)
+ {
+ c= *s;
+ if (c != '0')
+ break;
nz++;
+ }
if (s < end && c > '0' && c <= '9')
{
s0= s;
nf+= nz;
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.
We can stop counting digits after a while: the extra digits