xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

Blame SOURCES/libxml2-Bug-on-creating-new-stream-from-entity.patch

267d54
From 3154c607f22497fa843b8ad8a596ef5523d42ee6 Mon Sep 17 00:00:00 2001
267d54
From: Daniel Veillard <veillard@redhat.com>
267d54
Date: Fri, 20 Nov 2015 15:07:38 +0800
267d54
Subject: [PATCH] Bug on creating new stream from entity
267d54
To: libvir-list@redhat.com
267d54
267d54
sometimes the entity could have a lenght of 0, i.e. it wasn't
267d54
parsed or used yet, and we ended up with an incoherent input state
267d54
267d54
Signed-off-by: Daniel Veillard <veillard@redhat.com>
267d54
---
267d54
 parserInternals.c | 2 ++
267d54
 1 file changed, 2 insertions(+)
267d54
267d54
diff --git a/parserInternals.c b/parserInternals.c
267d54
index 9acfea4..1fe1f6a 100644
267d54
--- a/parserInternals.c
267d54
+++ b/parserInternals.c
267d54
@@ -1459,6 +1459,8 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
267d54
     if (entity->URI != NULL)
267d54
 	input->filename = (char *) xmlStrdup((xmlChar *) entity->URI);
267d54
     input->base = entity->content;
267d54
+    if (entity->length == 0)
267d54
+        entity->length = xmlStrlen(entity->content);
267d54
     input->cur = entity->content;
267d54
     input->length = entity->length;
267d54
     input->end = &entity->content[input->length];
267d54
-- 
267d54
2.5.0
267d54