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
commit02f90402c8218227c81f86f0b56cd283f7a2eb64 (patch)
tree4cdc4ef02aa465177482c7cc59eb6ec066d0adb3 /strings
parentb4ffce10d352eac2a31c37b54f24fdbc37444154 (diff)
downloadmariadb-git-02f90402c8218227c81f86f0b56cd283f7a2eb64.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