From 6f64682ca0b61d9c40c2fb4420b8b69c6891366c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 21 Jul 2021 17:16:00 +0200 Subject: [PATCH] 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 b7d67433b7c0, 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 --- src/cairo-tag-attributes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cairo-tag-attributes.c b/src/cairo-tag-attributes.c index 7977d87f4..dcd970787 100644 --- a/src/cairo-tag-attributes.c +++ b/src/cairo-tag-attributes.c @@ -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 {