From 8df7756f1b20d30895a816c55179b3e3c59d9c8d Mon Sep 17 00:00:00 2001 From: sammycage Date: Sun, 29 Oct 2023 15:05:56 +0100 Subject: [PATCH] Fix infinite loop issue caused by corrupt SVG file in parsePath #140 --- source/parser.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/parser.cpp b/source/parser.cpp index 071a496..714228b 100644 --- a/source/parser.cpp +++ b/source/parser.cpp @@ -323,6 +323,8 @@ Path Parser::parsePath(const std::string& string) currentPoint.x = c[3]; currentPoint.y = c[4]; } else if(command == 'Z' || command == 'z') { + if(lastCommand == 'Z' || lastCommand == 'z') + return path; path.close(); currentPoint.x = startPoint.x; currentPoint.y = startPoint.y;