[libxml2] Bug on creating new stream from entity



commit fdfeecc1b73b0318466f0d61f0b8881ed9d92dd2
Author: Daniel Veillard <veillard redhat com>
Date:   Fri Nov 20 15:07:38 2015 +0800

    Bug on creating new stream from entity
    
    sometimes the entity could have a lenght of 0, i.e. it wasn't
    parsed or used yet, and we ended up with an incoherent input state

 parserInternals.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/parserInternals.c b/parserInternals.c
index c8230c1..2b8646c 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -1459,6 +1459,8 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
     if (entity->URI != NULL)
        input->filename = (char *) xmlStrdup((xmlChar *) entity->URI);
     input->base = entity->content;
+    if (entity->length == 0)
+        entity->length = xmlStrlen(entity->content);
     input->cur = entity->content;
     input->length = entity->length;
     input->end = &entity->content[input->length];


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