1From 1813411ca9f9b60e62ef70e8be2e169af0831edb Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Wed, 2 Nov 2022 10:53:24 +0100
4Subject: [PATCH 03/28] schemas: Fix infinite loop in
5 xmlSchemaCheckElemSubstGroup
6
7Types like xmlSchemaTypeAnyTypeDef have a base type pointing to itself,
8resulting in an infinite loop.
9
10Fixes #430.
11
12Reference: https://github.com/GNOME/libxml2/commit/abb5a93fed95cfd628db72e9e1a51fc3ced5c941
13Conflict: NA
14---
15 xmlschemas.c | 3 ++-
16 1 file changed, 2 insertions(+), 1 deletion(-)
17
18diff --git a/xmlschemas.c b/xmlschemas.c
19index 9aa6acf..4a767ac 100644
20--- a/xmlschemas.c
21+++ b/xmlschemas.c
22@@ -19957,7 +19957,8 @@ xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt,
23 	    /*
24 	    * The set of all {derivation method}s involved in the derivation
25 	    */
26-	    while ((type != NULL) && (type != headType)) {
27+	    while ((type != NULL) && (type != headType) &&
28+                   (type != type->baseType)) {
29 		if ((WXS_IS_EXTENSION(type)) &&
30 		    ((methSet & XML_SCHEMAS_TYPE_BLOCK_RESTRICTION) == 0))
31 		    methSet |= XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
32-- 
332.27.0
34
35