[CVE-2022-40303] Fix integer overflows with XML_PARSE_HUGE 80/287280/1
authorNick Wellnhofer <wellnhofer@aevum.de>
Thu, 25 Aug 2022 15:43:08 +0000 (17:43 +0200)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 26 Jan 2023 06:54:03 +0000 (15:54 +0900)
commit8d01b2bd27148d71947847053bf96546318bac76
treedf2c320b1cf46fe1e34cdf7cb51687876a31e266
parent9daf701ad6e4f2d60a18341ff790b361406d59c3
[CVE-2022-40303] Fix integer overflows with XML_PARSE_HUGE

Also impose size limits when XML_PARSE_HUGE is set. Limit size of names
to XML_MAX_TEXT_LENGTH (10 million bytes) and other content to
XML_MAX_HUGE_LENGTH (1 billion bytes).

Move some the length checks to the end of the respective loop to make
them strict.

xmlParseEntityValue didn't have a length limitation at all. But without
XML_PARSE_HUGE, this should eventually trigger an error in xmlGROW.

Thanks to Maddie Stone working with Google Project Zero for the report!

Change-Id: If70b028a02c1ffce193baa26182b829f944c5d7a
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
parser.c