[libxml2] Do not process encoding values if the declaration if broken



commit 9aa37588ee78a06ca1379a9d9356eab16686099c
Author: Daniel Veillard <veillard redhat com>
Date:   Mon Jun 29 09:08:25 2015 +0800

    Do not process encoding values if the declaration if broken
    
    For https://bugzilla.gnome.org/show_bug.cgi?id=751603
    
    If the string is not properly terminated do not try to convert
    to the given encoding.

 parser.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/parser.c b/parser.c
index fe603ac..a3a9568 100644
--- a/parser.c
+++ b/parser.c
@@ -10404,6 +10404,8 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
            encoding = xmlParseEncName(ctxt);
            if (RAW != '"') {
                xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL);
+               xmlFree((xmlChar *) encoding);
+               return(NULL);
            } else
                NEXT;
        } else if (RAW == '\''){
@@ -10411,6 +10413,8 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
            encoding = xmlParseEncName(ctxt);
            if (RAW != '\'') {
                xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL);
+               xmlFree((xmlChar *) encoding);
+               return(NULL);
            } else
                NEXT;
        } else {


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