Commit f141ae42 authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

stop strtod() warning; add more checks; close #247

parent cad95d3d
......@@ -4128,8 +4128,15 @@ parser_yylex(parser_state *p)
}
tokfix(p);
if (is_float) {
(void)strtod(tok(p), 0); /* just check if float is within range */
if (errno == ERANGE) {
double d;
char *endp;
errno = 0;
d = strtod(tok(p), &endp);
if (d == 0 && endp == tok(p)) {
yywarning_s(p, "corrupted float value %s", tok(p));
}
else if (errno == ERANGE) {
yywarning_s(p, "float %s out of range", tok(p));
errno = 0;
}
......
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