xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone
Blob Blame History Raw
From 8d9f8c6dca5fd34743ed11ef0c570c4306db10e5 Mon Sep 17 00:00:00 2001
From: Daniel Veillard <veillard@redhat.com>
Date: Fri, 23 Oct 2015 19:02:28 +0800
Subject: [PATCH] Another variation of overflow in Conditional sections
To: libvir-list@redhat.com

Which happen after the previous fix to
https://bugzilla.gnome.org/show_bug.cgi?id=756456

But stopping the parser and exiting we didn't pop the intermediary entities
and doing the SKIP there applies on an input which may be too small

Signed-off-by: Daniel Veillard <veillard@redhat.com>
---
 parser.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/parser.c b/parser.c
index e2e0ad8..4926ab0 100644
--- a/parser.c
+++ b/parser.c
@@ -6895,7 +6895,9 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
 	"All markup of the conditional section is not in the same entity\n",
 				 NULL, NULL);
 	}
-        SKIP(3);
+	if ((ctxt-> instate != XML_PARSER_EOF) &&
+	    ((ctxt->input->cur + 3) < ctxt->input->end))
+	    SKIP(3);
     }
 }
 
-- 
2.5.0