diff options
author | Daniel Veillard <veillard@redhat.com> | 2013-02-13 18:19:42 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2013-02-13 18:19:42 +0800 |
commit | bf058dce131751ff8b69d32eae68cf564cd73aef (patch) | |
tree | f5e42fc735ce15404d2b19c330a3ea748c8b435a /parser.c | |
parent | de0cc20c29cb3f056062925395e0f68d2250a46f (diff) | |
download | android_external_libxml2-bf058dce131751ff8b69d32eae68cf564cd73aef.tar.gz android_external_libxml2-bf058dce131751ff8b69d32eae68cf564cd73aef.tar.bz2 android_external_libxml2-bf058dce131751ff8b69d32eae68cf564cd73aef.zip |
Fix the flushing out of raw buffers on encoding conversions
https://bugzilla.gnome.org/show_bug.cgi?id=692915
the new set of converting functions tried to limit the encoding
conversion of the raw buffer to the consumption one to work in
a more progressive fashion. Unfortunately this was bad for
performances and led to errors on progressive parsing when
a very large chunk was close to the end of the document. Fix
the new internal function and switch back to the old way of
converting. Fix another bug in the process.
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -11122,9 +11122,13 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { /* * If we are operating on converted input, try to flush * remainng chars to avoid them stalling in the non-converted - * buffer. + * buffer. But do not do this in document start where + * encoding="..." may not have been read and we work on a + * guessed encoding. */ - if (xmlBufIsEmpty(ctxt->input->buf->buffer) == 0) { + if ((ctxt->instate != XML_PARSER_START) && + (ctxt->input->buf->raw != NULL) && + (xmlBufIsEmpty(ctxt->input->buf->raw) == 0)) { size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input); size_t current = ctxt->input->cur - ctxt->input->base; @@ -12146,7 +12150,7 @@ xmldecl_done: size_t base = xmlBufGetInputBase(in->buffer, ctxt->input); size_t current = ctxt->input->cur - ctxt->input->base; - nbchars = xmlCharEncInput(in); + nbchars = xmlCharEncInput(in, terminate); if (nbchars < 0) { /* TODO 2.6.0 */ xmlGenericError(xmlGenericErrorContext, |