• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 4adaddde0ce237da7e8eb5210f1f0eb529c39447 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Thu, 24 Nov 2022 16:38:47 +0100
4Subject: [PATCH 25/28] parser: Don't call *DefaultSAXHandlerInit from
5 xmlInitParser
6
7Change the default handler definitions to match the result after calling
8the initialization functions.
9
10This makes sure that no thread-local variables are accessed when calling
11xmlInitParser.
12
13Reference: https://github.com/GNOME/libxml2/commit/cecd364dd2f55810ab27eb0f44b35197a1a358d8
14Conflict: SAX2.c:<xmlDefaultSAXHandlerInit> parser.c:<xmlInitParser>
15---
16 SAX2.c    | 4 ----
17 globals.c | 6 +++---
18 parser.c  | 2 --
19 3 files changed, 3 insertions(+), 9 deletions(-)
20
21diff --git a/SAX2.c b/SAX2.c
22index 96bbcb3..3eebd2b 100644
23--- a/SAX2.c
24+++ b/SAX2.c
25@@ -2910,9 +2910,6 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
26 void
27 xmlDefaultSAXHandlerInit(void)
28 {
29-#ifdef LIBXML_SAX1_ENABLED
30-    xmlSAXVersion((xmlSAXHandlerPtr) &xmlDefaultSAXHandler, 1);
31-#endif /* LIBXML_SAX1_ENABLED */
32 }
33
34 #ifdef LIBXML_HTML_ENABLED
35@@ -2968,7 +2965,6 @@ xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
36 void
37 htmlDefaultSAXHandlerInit(void)
38 {
39-    xmlSAX2InitHtmlDefaultSAXHandler((xmlSAXHandlerPtr) &htmlDefaultSAXHandler);
40 }
41
42 #endif /* LIBXML_HTML_ENABLED */
43diff --git a/globals.c b/globals.c
44index 893fb73..836bee1 100644
45--- a/globals.c
46+++ b/globals.c
47@@ -388,7 +388,7 @@ xmlSAXHandlerV1 xmlDefaultSAXHandler = {
48     xmlSAX2GetParameterEntity,
49     xmlSAX2CDataBlock,
50     xmlSAX2ExternalSubset,
51-    0,
52+    1,
53 };
54 #endif /* LIBXML_SAX1_ENABLED */
55
56@@ -436,10 +436,10 @@ xmlSAXHandlerV1 htmlDefaultSAXHandler = {
57     xmlParserWarning,
58     xmlParserError,
59     xmlParserError,
60-    xmlSAX2GetParameterEntity,
61+    NULL,
62     xmlSAX2CDataBlock,
63     NULL,
64-    0,
65+    1,
66 };
67 #endif /* LIBXML_HTML_ENABLED */
68
69diff --git a/parser.c b/parser.c
70index 4405a7e..9d50138 100644
71--- a/parser.c
72+++ b/parser.c
73@@ -14696,14 +14696,12 @@ xmlInitParser(void) {
74 	xmlInitMemory();
75         xmlInitializeDict();
76 	xmlInitCharEncodingHandlers();
77-	xmlDefaultSAXHandlerInit();
78 	xmlRegisterDefaultInputCallbacks();
79 #ifdef LIBXML_OUTPUT_ENABLED
80 	xmlRegisterDefaultOutputCallbacks();
81 #endif /* LIBXML_OUTPUT_ENABLED */
82 #ifdef LIBXML_HTML_ENABLED
83 	htmlInitAutoClose();
84-	htmlDefaultSAXHandlerInit();
85 #endif
86 #ifdef LIBXML_XPATH_ENABLED
87 	xmlXPathInit();
88--
892.27.0
90
91