loader/svg: Skip check for quotes inside quotes

Single or double quotation marks that occur before
closing the quotation mark are ignored.
This commit is contained in:
JunsuChoi 2024-01-08 17:51:52 +09:00 committed by Hermet Park
parent 80fa5fca22
commit 2726eb8baa

View file

@ -171,10 +171,11 @@ static const char* _simpleXmlFindStartTag(const char* itr, const char* itrEnd)
static const char* _simpleXmlFindEndTag(const char* itr, const char* itrEnd)
{
bool insideQuote = false;
bool insideQuote[2] = {false, false}; // 0: ", 1: '
for (; itr < itrEnd; itr++) {
if (*itr == '"') insideQuote = !insideQuote;
if (!insideQuote) {
if (*itr == '"' && !insideQuote[1]) insideQuote[0] = !insideQuote[0];
if (*itr == '\'' && !insideQuote[0]) insideQuote[1] = !insideQuote[1];
if (!insideQuote[0] && !insideQuote[1]) {
if ((*itr == '>') || (*itr == '<'))
return itr;
}