GNOME Bugzilla – Bug 771799
XML_PARSE_HUGE (possibly) relaxed in xmlParserEntityCheck()
Last modified: 2021-07-05 13:21:53 UTC
Created attachment 336039 [details] [review] Allow non-linear entity expansion's check even when XML_PARSE_HUGE is used I would like to be able to parse any element with size > 10MB, but still being protected against exponential linear entity expansion. While I can control the size of the file/buffer being passed (or not) to the libxml2 parser (hence using XML_PARSE_HUGE to bypass hardcoded limits), this is of no help against evily defined entities. The attached patch proposes a new XML_PARSE_CHECKENT option which can be used jointly with XML_PARSE_HUGE, for this purpose...
Created attachment 336040 [details] [review] Allow non-linear entity expansion's check even when XML_PARSE_HUGE is used Fix typo in previous patch.
Created attachment 336041 [details] [review] Allow non-linear entity expansion's check even when XML_PARSE_HUGE is used Sorry, same file sent twice above, this one really fixes the typo.
Created attachment 336667 [details] [review] Allow non-linear entity expansion's check even when XML_PARSE_HUGE is used Latest (now working) version of the patch.
Any taker? The 10MB limit is really an arbitrary value, please let the user control it...
Yes, the correct solution is move everyone *away* from XML_PARSE_HUGE. Most people only have a problem with the 10MB text size limit. This should be a per-parser setting, so you don't need XML_PARSE_HUGE in the first place.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.