[libxml2] Fix HTML parsing with 0 character in CDATA



commit 856c668c1abc0fb699c2bfb84687d91e33e990bb
Author: Daniel Veillard <veillard redhat com>
Date:   Mon Aug 24 18:16:56 2009 +0200

    Fix HTML parsing with 0 character in CDATA
    
    * HTMLparser.c: 0 before the end of the input need some special case
      handling, raise the error and return a space instead

 HTMLparser.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/HTMLparser.c b/HTMLparser.c
index f5957c5..d3c09d6 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -425,6 +425,13 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
 	    }
 	    return(val);
 	} else {
+            if ((*ctxt->input->cur == 0) &&
+                (ctxt->input->cur < ctxt->input->end)) {
+                    htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
+				"Char 0x%X out of allowed range\n", 0);
+                *len = 1;
+                return(' ');
+            }
 	    /* 1-byte code */
 	    *len = 1;
 	    return((int) *ctxt->input->cur);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]