diff options
author | Daniel Veillard <veillard@redhat.com> | 2009-09-15 18:41:30 +0200 |
---|---|---|
committer | Mike Hommey <glandium@debian.org> | 2009-09-16 00:12:23 +0200 |
commit | 95b9b117ee855be606776248d19b51dc4ae2abd9 (patch) | |
tree | 8170795d27db1d5de3c1b6437cd637532aad5eb7 | |
parent | fff43b9320722e947de31e80d2a8309169efce2b (diff) | |
download | libxml2-95b9b117ee855be606776248d19b51dc4ae2abd9.tar.gz |
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.
-rw-r--r-- | parser.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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)))) { /* |