Blame SOURCES/libxml2-2.9.7-CVE-2020-7595.patch

a2f31b
From 0e1a49c8907645d2e155f0d89d4d9895ac5112b5 Mon Sep 17 00:00:00 2001
a2f31b
From: Zhipeng Xie <xiezhipeng1@huawei.com>
a2f31b
Date: Thu, 12 Dec 2019 17:30:55 +0800
a2f31b
Subject: [PATCH] Fix infinite loop in xmlStringLenDecodeEntities
a2f31b
a2f31b
When ctxt->instate == XML_PARSER_EOF,xmlParseStringEntityRef
a2f31b
return NULL which cause a infinite loop in xmlStringLenDecodeEntities
a2f31b
a2f31b
Found with libFuzzer.
a2f31b
a2f31b
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
a2f31b
---
a2f31b
 parser.c | 3 ++-
a2f31b
 1 file changed, 2 insertions(+), 1 deletion(-)
a2f31b
a2f31b
diff --git a/parser.c b/parser.c
a2f31b
index d1c31963..a34bb6cd 100644
a2f31b
--- a/parser.c
a2f31b
+++ b/parser.c
a2f31b
@@ -2646,7 +2646,8 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
a2f31b
     else
a2f31b
         c = 0;
a2f31b
     while ((c != 0) && (c != end) && /* non input consuming loop */
a2f31b
-	   (c != end2) && (c != end3)) {
a2f31b
+           (c != end2) && (c != end3) &&
a2f31b
+           (ctxt->instate != XML_PARSER_EOF)) {
a2f31b
 
a2f31b
 	if (c == 0) break;
a2f31b
         if ((c == '&') && (str[1] == '#')) {
a2f31b
-- 
a2f31b
2.24.1
a2f31b