fixing bug #99190 when UTF8 document are parsed using the progressive
* parserInternals.c: fixing bug #99190 when UTF8 document are
parsed using the progressive parser and the end of the chunk
is in the middle of an UTF8 multibyte character.
Daniel
diff --git a/parserInternals.c b/parserInternals.c
index c9ea6ed..e74801f 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -1349,6 +1349,16 @@
return((int) *ctxt->input->cur);
encoding_error:
/*
+ * An encoding problem may arise from a truncated input buffer
+ * splitting a character in the middle. In that case do not raise
+ * an error but return 0 to endicate an end of stream problem
+ */
+ if (ctxt->input->end - ctxt->input->cur < 4) {
+ *len = 0;
+ return(0);
+ }
+
+ /*
* If we detect an UTF8 error that probably mean that the
* input encoding didn't get properly advertised in the
* declaration header. Report the error and switch the encoding