From 0fd00ec5f51065340c98f084df045d76258c6bc3 Mon Sep 17 00:00:00 2001
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
Date: Thu, 9 Apr 2026 14:11:48 +0200
Subject: [PATCH] c14n: Fix Type confusion in xmlC14NProcessAttrsAxis

Fix https://gitlab.gnome.org/GNOME/libxml2/-/issues/1096

Thanks to Nick Wellnhofer for the report.
---
 c14n.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/c14n.c b/c14n.c
index 4dd54b96c..882e90387 100644
--- a/c14n.c
+++ b/c14n.c
@@ -1170,7 +1170,7 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
              * visible!
              */
             tmp = cur->parent;
-            while (tmp != NULL) {
+            while (tmp != NULL && tmp->type == XML_ELEMENT_NODE) {
                 attr = tmp->properties;
                 while (attr != NULL) {
                     if (xmlC14NIsXmlAttr(attr) != 0) {
-- 
GitLab

