Handle _cairo_strtod() failures in parse_float()

When strtod cannot do anything, it returns zero and sets the end pointer
to the beginning of the string. This commit changes the code in
parse_float() to treat this case as an error.

Without the fix from commit b7d67433b7, this commit turns the error
from an endless loop into a parse error, which is a lot better error
behaviour.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2021-07-21 17:16:00 +02:00
parent ab82549f03
commit 6f64682ca0

View file

@ -232,7 +232,7 @@ parse_float (const char *p, double *d)
if (has_decimal_point) {
char *end;
*d = _cairo_strtod (start, &end);
if (end)
if (end && end != start)
return end;
} else {