xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

Blame SOURCES/libxml2-2.9.7-CVE-2019-20388.patch

bcf091
From 7ffcd44d7e6c46704f8af0321d9314cd26e0e18a Mon Sep 17 00:00:00 2001
bcf091
From: Zhipeng Xie <xiezhipeng1@huawei.com>
bcf091
Date: Tue, 20 Aug 2019 16:33:06 +0800
bcf091
Subject: [PATCH] Fix memory leak in xmlSchemaValidateStream
bcf091
bcf091
When ctxt->schema is NULL, xmlSchemaSAXPlug->xmlSchemaPreRun
bcf091
alloc a new schema for ctxt->schema and set vctxt->xsiAssemble
bcf091
to 1. Then xmlSchemaVStart->xmlSchemaPreRun initialize
bcf091
vctxt->xsiAssemble to 0 again which cause the alloced schema
bcf091
can not be freed anymore.
bcf091
bcf091
Found with libFuzzer.
bcf091
bcf091
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
bcf091
---
bcf091
 xmlschemas.c | 1 -
bcf091
 1 file changed, 1 deletion(-)
bcf091
bcf091
diff --git a/xmlschemas.c b/xmlschemas.c
bcf091
index 301c8449..39d92182 100644
bcf091
--- a/xmlschemas.c
bcf091
+++ b/xmlschemas.c
bcf091
@@ -28090,7 +28090,6 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) {
bcf091
     vctxt->nberrors = 0;
bcf091
     vctxt->depth = -1;
bcf091
     vctxt->skipDepth = -1;
bcf091
-    vctxt->xsiAssemble = 0;
bcf091
     vctxt->hasKeyrefs = 0;
bcf091
 #ifdef ENABLE_IDC_NODE_TABLES_TEST
bcf091
     vctxt->createIDCNodeTables = 1;
bcf091
-- 
bcf091
2.24.1
bcf091