mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
svg: prevent runtime error
runtime error: applying non-zero offset 1 to null pointer Observed for Bespoke-leather-belt-2016012857.svg
This commit is contained in:
parent
cebc29c5ff
commit
35bc063edd
1 changed files with 4 additions and 3 deletions
|
@ -492,13 +492,13 @@ bool simpleXmlParseW3CAttribute(const char* buf, unsigned bufLength, simpleXMLAt
|
|||
key[0] = '\0';
|
||||
val[0] = '\0';
|
||||
|
||||
if (next == nullptr && sep != nullptr) {
|
||||
if (sep != nullptr && next == nullptr) {
|
||||
memcpy(key, buf, sep - buf);
|
||||
key[sep - buf] = '\0';
|
||||
|
||||
memcpy(val, sep + 1, end - sep - 1);
|
||||
val[end - sep - 1] = '\0';
|
||||
} else if (sep < next && sep != nullptr) {
|
||||
} else if (sep != nullptr && sep < next) {
|
||||
memcpy(key, buf, sep - buf);
|
||||
key[sep - buf] = '\0';
|
||||
|
||||
|
@ -522,8 +522,9 @@ bool simpleXmlParseW3CAttribute(const char* buf, unsigned bufLength, simpleXMLAt
|
|||
}
|
||||
}
|
||||
|
||||
if (!next) break;
|
||||
buf = next + 1;
|
||||
} while (next != nullptr);
|
||||
} while (true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue