diff --git a/ChangeLog b/ChangeLog index 41613d09..644d4be4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Nov 22 13:26:19 CET 2002 Daniel Veillard + + * 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. + Fri Nov 22 13:13:00 HKT 2002 William Brack * threads.c: fixed initialization problem in xmlNewGlobalState diff --git a/parserInternals.c b/parserInternals.c index c9ea6ed8..e74801fa 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -1348,6 +1348,16 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { } 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