Submitted By:            Xi Ruoyao <xry111@xry111.site>
Date:                    2025-09-22
Initial Package Version: 2.15.0
Upstream Status:         Applied
Origin:                  Upstream (see the From line below for revision)
Description:             Fix an issue parsing not normalized yet
                         attribute values.  The issue is at least
                         causing Postgres documentation fail to build.

From da45a190f718e8e2f0e3d2a6325ffa23abc8b90c Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Fri, 19 Sep 2025 13:39:41 +0200
Subject: [PATCH] parser: Fix attribute normalization and standalone check

Regressed with e4cbc295.
---
 parser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/parser.c b/parser.c
index 2c3d90484..c7f46a31a 100644
--- a/parser.c
+++ b/parser.c
@@ -4025,7 +4025,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *attlen, int *outFlags,
     int c, l, quote, entFlags, chunkSize;
     int inSpace = 1;
     int replaceEntities;
-    int normalize = (special & XML_SPECIAL_TYPE_MASK) != 0;
+    int normalize = (special & XML_SPECIAL_TYPE_MASK) > XML_ATTRIBUTE_CDATA;
     int attvalFlags = 0;
 
     /* Always expand namespace URIs */
@@ -8578,7 +8578,7 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
 
 #ifdef LIBXML_VALID_ENABLED
     if ((ctxt->validate) &&
-        (ctxt->standalone) &&
+        (ctxt->standalone == 1) &&
         (special & XML_SPECIAL_EXTERNAL) &&
         (flags & XML_ATTVAL_NORM_CHANGE)) {
         xmlValidityError(ctxt, XML_DTD_NOT_STANDALONE,
-- 
GitLab

