libxml2/backport-schemas-Fix-infinite-loop-in-xmlSchemaCheckElemSubst.patch
Zhipeng Xie 6a272753c8 backport upstream patches
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
2023-02-27 19:39:37 +08:00

32 lines
1020 B
Diff

From 4a568a14077bd4cf03878ee9e2d8fb7e79ff7641 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Wed, 2 Nov 2022 10:53:24 +0100
Subject: [PATCH 3/3] schemas: Fix infinite loop in
xmlSchemaCheckElemSubstGroup
Types like xmlSchemaTypeAnyTypeDef have a base type pointing to itself,
resulting in an infinite loop.
Fixes #430.
---
xmlschemas.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xmlschemas.c b/xmlschemas.c
index 2da962b..a62db2d 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -19957,7 +19957,8 @@ xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt,
/*
* The set of all {derivation method}s involved in the derivation
*/
- while ((type != NULL) && (type != headType)) {
+ while ((type != NULL) && (type != headType) &&
+ (type != type->baseType)) {
if ((WXS_IS_EXTENSION(type)) &&
((methSet & XML_SCHEMAS_TYPE_BLOCK_RESTRICTION) == 0))
methSet |= XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
--
2.27.0