-
-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Huge input lookup with large CDATA when parsing (SAX) #2132
Comments
@CloCkWeRX Thanks for submitting this report! I'll take a look as soon as I can to determine if it's a dupe of #2028 ... and if so will probably reconsider whether we should vendor the upstream patch to address it. |
@CloCkWeRX Unfortunately the libxml2 patches that addressed #2028 do not address this particular problem. I'll noodle a bit to see if I can discover the root cause. |
OK, found the problem, which is similar to the issue fixed by this (unmerged) upstream commit: https://gitlab.gnome.org/nwellnhof/libxml2/-/commit/99bda1e1ee77783e43c9059af00cd326deee3372 Let's see what @nwellnhof thinks. Edit: Note that the following patch, applied to libxml2, will address your issue: diff --git a/parser.c b/parser.c
index 85494df..6f6ef78 100644
--- a/parser.c
+++ b/parser.c
@@ -9776,6 +9776,7 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
sl = l;
count++;
if (count > 50) {
+ SHRINK;
GROW;
if (ctxt->instate == XML_PARSER_EOF) {
xmlFree(buf); |
Please note that I've also mentioned in an upstream issue at https://gitlab.gnome.org/GNOME/libxml2/-/issues/200 |
Upstream has asked me to submit a PR to fix this in libxml2 -- see Nick's comment at https://gitlab.gnome.org/GNOME/libxml2/-/issues/200. I'll try to get to that in the next few days. |
This patch shrinks the libxml2 input buffer in a few parser functions. Fixes #2132
This patch shrinks the libxml2 input buffer in a few parser functions. Fixes #2132
I've submitted a merge request upstream at https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/100 I've also got a PR with the test case @CloCkWeRX provided and the libxml2 patch ready at #2182. |
This patch shrinks the libxml2 input buffer in a few parser functions. Fixes #2132
Fixes GNOME/libxml2#200 Also see discussions at: - GNOME/libxml2#192 - https://gitlab.gnome.org/nwellnhof/libxml2/-/commit/99bda1e - sparklemotion/nokogiri#2132
Please describe the bug
Potentially a duplicate of #2028 - however this input didn't have linebreaks.
Help us reproduce what you're seeing
Executable test case:
Expected behavior
No errors in both cases
Environment
Additional context
The text was updated successfully, but these errors were encountered: