libxslt/libxslt-reproducible.patch
Pedro Monreal Gonzalez 26d6e58210 - Update to 1.1.42:
* Regressions:
    - extensions: Readd call to xmlCheckFilename with older libxml2
  * Improvments:
    - utils: Don't use deprecated xmlCharEncodingHandler member
    - transform: Handle filesystem paths after libxml2 changes
    - locale: Work around issue with FreeBSD's strxfrm_l
  * Build systems:
    - cmake: Add LIBXSLT_WITH_PROGRAMS option (Don Olmstead)
    - cmake: Fix HAVE_GCRYPT check
- Update to 1.1.41:
  * Removals:
    - autotools: Stop installing libxslt.m4
    - autotools: Remove RPM build
  * Improvements:
    - libxslt: Set _FILE_OFFSET_BITS to 64
    - xsltproc: Remove unneeded includes
    - include: Don't define ATTRIBUTE_UNUSED in public header
    - xsltproc: Make "-" read from stdin
  * Build systems:
    - cmake: Adjust paths for UNIX or UNIX-like target systems (Daniel E)
  * Tests:
    - cmake: Link testplugin with libxml2
    - tests: Link testplugin with libxml2
    - tests: Fix expected error after libxml2 change
    - runtest: Switch to xmlFormatError
    - fuzz: Avoid accessing internal struct members
- Update to 1.1.40:
  * Removals:
    - xsltproc: remove maxparserdepth option (Mike Dalessio)

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxslt?expand=0&rev=107
2025-01-17 17:19:05 +00:00

76 lines
2.3 KiB
Diff

https://gitlab.gnome.org/GNOME/libxslt/-/issues/123
From c45ed81aeb50a7fb6799a166270d6ccc9ffa63b2 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Thu, 19 Sep 2024 21:49:46 +0200
Subject: [PATCH] variables: Fix non-deterministic generated IDs
Evaluate global variables in deterministic order. Otherwise, generated
IDs could be non-deterministic if generate-id() is called.
Fixes #123.
---
libxslt/variables.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/libxslt/variables.c b/libxslt/variables.c
index 93cb0747..09069aa3 100644
--- a/libxslt/variables.c
+++ b/libxslt/variables.c
@@ -1259,13 +1259,6 @@ error:
return(result);
}
-static void
-xsltEvalGlobalVariableWrapper(void *payload, void *data,
- const xmlChar *name ATTRIBUTE_UNUSED) {
- xsltEvalGlobalVariable((xsltStackElemPtr) payload,
- (xsltTransformContextPtr) data);
-}
-
/**
* xsltEvalGlobalVariables:
* @ctxt: the XSLT transformation context
@@ -1278,6 +1271,7 @@ xsltEvalGlobalVariableWrapper(void *payload, void *data,
int
xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
xsltStackElemPtr elem;
+ xsltStackElemPtr head = NULL;
xsltStylesheetPtr style;
if ((ctxt == NULL) || (ctxt->document == NULL))
@@ -1321,6 +1315,8 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
xsltFreeStackElem(def);
return(-1);
}
+ def->next = head;
+ head = def;
} else if ((elem->comp != NULL) &&
(elem->comp->type == XSLT_FUNC_VARIABLE)) {
/*
@@ -1343,9 +1339,19 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
}
/*
- * This part does the actual evaluation
+ * This part does the actual evaluation. Note that scanning the hash
+ * table would result in a non-deterministic order, leading to
+ * non-deterministic generated IDs.
*/
- xmlHashScan(ctxt->globalVars, xsltEvalGlobalVariableWrapper, ctxt);
+ elem = head;
+ while (elem != NULL) {
+ xsltStackElemPtr next;
+
+ xsltEvalGlobalVariable(elem, ctxt);
+ next = elem->next;
+ elem->next = NULL;
+ elem = next;
+ }
return(0);
}
--
GitLab