From a0c48addfc8aaba3394fb7e06a4b3039214d48d1 Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Fri, 16 Apr 2004 15:58:29 +0000 Subject: [PATCH] fixed problem with detecting external dtd encoding (bug 135229). minor * parser.c: fixed problem with detecting external dtd encoding (bug 135229). * Makefile.am: minor change to test label --- ChangeLog | 6 ++++++ Makefile.am | 2 +- parser.c | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5e9c83a..beb6de31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Apr 16 23:58:42 HKT 2004 William Brack + + * parser.c: fixed problem with detecting external dtd + encoding (bug 135229). + * Makefile.am: minor change to test label + Fri Apr 16 16:09:31 HKT 2004 William Brack * xinclude.c: fixed problem causing duplicate fallback diff --git a/Makefile.am b/Makefile.am index e567c861..2dd69a3f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -899,7 +899,7 @@ Relaxtests: xmllint$(EXEEXT) diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \ err.$$name | grep -v "error detected at";\ fi ; grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ + if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \ rm res.$$name err.$$name ; \ fi ; fi ; \ done; done) diff --git a/parser.c b/parser.c index bbec0bee..76629298 100644 --- a/parser.c +++ b/parser.c @@ -1825,9 +1825,13 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { * Get the 4 first bytes and decode the charset * if enc != XML_CHAR_ENCODING_NONE * plug some encoding conversion routines. + * Note that, since we may have some non-UTF8 + * encoding (like UTF16, bug 135229), the 'length' + * is not known, but we can calculate based upon + * the amount of data in the buffer. */ GROW - if (entity->length >= 4) { + if ((ctxt->input->end - ctxt->input->cur)>=4) { start[0] = RAW; start[1] = NXT(1); start[2] = NXT(2);