libxml2/libxml2-2.7.4-input-parser.patch
2009-09-15 17:02:03 +00:00

34 lines
1.3 KiB
Diff

commit 9d3d141c412baa5c713ad3df48f1a4d179e07b05
Author: Daniel Veillard <veillard@redhat.com>
Date: Tue Sep 15 18:41:30 2009 +0200
Fix a parsing problem with little data at startup
* parser.c: inkscape extension loader (and possibly others) feed
data to the parser very slowly, 0 at start, 4 bytes on first GROW
and this broke after the fix for
https://bugzilla.gnome.org/show_bug.cgi?id=566012
http://git.gnome.org/cgit/libxml2/commit/?id=7e385bd4e28a0cc12b6b26ed178c620e3c3ab8d8
leading to another bug
https://bugzilla.redhat.com/show_bug.cgi?id=523002
this detects the situation and GROW when needed for proper processing.
diff --git a/parser.c b/parser.c
index e415339..b41dcc3 100644
--- a/parser.c
+++ b/parser.c
@@ -10130,8 +10130,12 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
/*
* Check for the XMLDecl in the Prolog.
* do not GROW here to avoid the detected encoder to decode more
- * than just the first line
+ * than just the first line, unless the amount of data is really
+ * too small to hold "<?xml version="1.0" encoding="foo"
*/
+ if ((ctxt->input->end - ctxt->input->cur) < 35) {
+ GROW;
+ }
if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
/*