Blame SOURCES/libxml2-2.9.1-CVE-2019-19956.patch
|
|
1b2bf5 |
From 5a02583c7e683896d84878bd90641d8d9b0d0549 Mon Sep 17 00:00:00 2001
|
|
|
1b2bf5 |
From: Zhipeng Xie <xiezhipeng1@huawei.com>
|
|
|
1b2bf5 |
Date: Wed, 7 Aug 2019 17:39:17 +0800
|
|
|
1b2bf5 |
Subject: [PATCH] Fix memory leak in xmlParseBalancedChunkMemoryRecover
|
|
|
1b2bf5 |
|
|
|
1b2bf5 |
When doc is NULL, namespace created in xmlTreeEnsureXMLDecl
|
|
|
1b2bf5 |
is bind to newDoc->oldNs, in this case, set newDoc->oldNs to
|
|
|
1b2bf5 |
NULL and free newDoc will cause a memory leak.
|
|
|
1b2bf5 |
|
|
|
1b2bf5 |
Found with libFuzzer.
|
|
|
1b2bf5 |
|
|
|
1b2bf5 |
Closes #82.
|
|
|
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 1ce1ccf1..26d9f4e3 100644
|
|
|
1b2bf5 |
--- a/parser.c
|
|
|
1b2bf5 |
+++ b/parser.c
|
|
|
1b2bf5 |
@@ -13894,7 +13894,8 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
|
|
|
1b2bf5 |
xmlFreeParserCtxt(ctxt);
|
|
|
1b2bf5 |
newDoc->intSubset = NULL;
|
|
|
1b2bf5 |
newDoc->extSubset = NULL;
|
|
|
1b2bf5 |
- newDoc->oldNs = NULL;
|
|
|
1b2bf5 |
+ if(doc != NULL)
|
|
|
1b2bf5 |
+ newDoc->oldNs = NULL;
|
|
|
1b2bf5 |
xmlFreeDoc(newDoc);
|
|
|
1b2bf5 |
|
|
|
1b2bf5 |
return(ret);
|
|
|
1b2bf5 |
--
|
|
|
1b2bf5 |
2.24.1
|
|
|
1b2bf5 |
|