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

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