From d70f2075771500784d670bec5b873b19e46651ec Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Mon, 19 Apr 2021 14:15:57 +0100 Subject: [PATCH] SVG parse_svg_value: restore val and is_percent to default values on parsing failure --- src/svg/svg_parser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index 9cc18f39d..020e50552 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -275,7 +275,8 @@ double parse_svg_value(T & err_handler, const char* str, bool & is_percent) x3::lit('%')[apply_percent]), x3::space) || (cur != end)) { - val = 0.0; + val = 0.0; // restore default value on parsing failure + is_percent = true; // viewport/viewBox logic expects default value to be `true` on failure err_handler.on_error("SVG parse error: failed to parse with value \"" + std::string(str) + "\""); } return val;