summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2015-11-20 15:07:38 +0800
committerDaniel Veillard <veillard@redhat.com>2015-11-20 15:07:38 +0800
commitfdfeecc1b73b0318466f0d61f0b8881ed9d92dd2 (patch)
tree7e6bea14c54f00a128e461dcbe71305e77d7868b
parent3bd6ae147e294da6b378379cc87615b8fc111e73 (diff)
downloadlibxml2-fdfeecc1b73b0318466f0d61f0b8881ed9d92dd2.tar.gz
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
-rw-r--r--parserInternals.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/parserInternals.c b/parserInternals.c
index c8230c1c..2b8646c2 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];