File libxml2-CVE-2024-56171.patch of Package libxml2.37639
From 5880a9a6bd97c0f9ac8fc4f30110fe023f484746 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 10 Dec 2024 16:52:05 +0100
Subject: [PATCH] [CVE-2024-56171] Fix use-after-free after
xmlSchemaItemListAdd
xmlSchemaItemListAdd can reallocate the items array. Update local
variables after adding item in
- xmlSchemaIDCFillNodeTables
- xmlSchemaBubbleIDCNodeTables
Fixes #828.
---
xmlschemas.c | 3 +++
1 file changed, 3 insertions(+)
Index: libxml2-2.10.3/xmlschemas.c
===================================================================
--- libxml2-2.10.3.orig/xmlschemas.c
+++ libxml2-2.10.3/xmlschemas.c
@@ -23658,6 +23658,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaVali
}
if (xmlSchemaItemListAdd(bind->dupls, bind->nodeTable[j]) == -1)
goto internal_error;
+ dupls = (xmlSchemaPSVIIDCNodePtr *) bind->dupls->items;
/*
* Remove the duplicate entry from the IDC node-table.
*/
@@ -23874,6 +23875,8 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaVa
goto internal_error;
}
xmlSchemaItemListAdd(parBind->dupls, parNode);
+ dupls = (xmlSchemaPSVIIDCNodePtr *)
+ parBind->dupls->items;
} else {
/*
* Add the node-table entry (node and key-sequence) of