From a4ced1963ed690af528014f4a48601c2675f5fbb Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Thu, 4 Apr 2024 11:17:16 +0900 Subject: [PATCH] loader/svg: Fix invalid syntax check If the key is not parsed and the '=' keyword is located next, modify it to parse the following syntax. related issue: https://github.com/thorvg/thorvg/issues/2116 --- src/loaders/svg/tvgXmlParser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/loaders/svg/tvgXmlParser.cpp b/src/loaders/svg/tvgXmlParser.cpp index 6530d522..09fc8aaa 100644 --- a/src/loaders/svg/tvgXmlParser.cpp +++ b/src/loaders/svg/tvgXmlParser.cpp @@ -314,7 +314,10 @@ bool simpleXmlParseAttributes(const char* buf, unsigned bufLength, simpleXMLAttr if ((*keyEnd == '=') || (isspace((unsigned char)*keyEnd))) break; } if (keyEnd == itrEnd) goto error; - if (keyEnd == key) continue; + if (keyEnd == key) { // There is no key. This case is invalid, but explores the following syntax. + itr = keyEnd + 1; + continue; + } if (*keyEnd == '=') value = keyEnd + 1; else {