From d4b54471417878a6d06e79e43a4f7afb7ba69fdd Mon Sep 17 00:00:00 2001 From: Pierre Belzile Date: Thu, 4 Nov 2010 10:18:17 +0100 Subject: [PATCH] 614005 Possible erroneous HTML parsing on unterminated script Fix a nasty error handling problem when an error happen at the end of the input buffer. --- HTMLparser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/HTMLparser.c b/HTMLparser.c index 04bfbd4e..7db6f0c7 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -2887,9 +2887,11 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { } if ((!(IS_CHAR_CH(cur))) && (!((cur == 0) && (ctxt->progressive)))) { - htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, - "Invalid char in CDATA 0x%X\n", cur); - NEXT; + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in CDATA 0x%X\n", cur); + if (ctxt->input->cur < ctxt->input->end) { + NEXT; + } } if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) {