From 95b9b117ee855be606776248d19b51dc4ae2abd9 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 15 Sep 2009 18:41:30 +0200 Subject: 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. --- parser.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'parser.c') 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 "input->end - ctxt->input->cur) < 35) { + GROW; + } if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) { /* -- cgit v1.2.3