!203 [sync] PR-198: SAX: Always initialize SAX1 element handlers
From: @openeuler-sync-bot Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
d9a541b676
67
backport-SAX-Always-initialize-SAX1-element-handlers.patch
Normal file
67
backport-SAX-Always-initialize-SAX1-element-handlers.patch
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
From 235b15a590eecf97b09e87bdb7e4f8333e9de129 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||||
|
Date: Mon, 8 May 2023 17:58:02 +0200
|
||||||
|
Subject: [PATCH] SAX: Always initialize SAX1 element handlers
|
||||||
|
|
||||||
|
Follow-up to commit d0c3f01e. A parser context will be initialized to
|
||||||
|
SAX version 2, but this can be overridden with XML_PARSE_SAX1 later,
|
||||||
|
so we must initialize the SAX1 element handlers as well.
|
||||||
|
|
||||||
|
Change the check in xmlDetectSAX2 to only look for XML_SAX2_MAGIC, so
|
||||||
|
we don't switch to SAX1 if the SAX2 element handlers are NULL.
|
||||||
|
---
|
||||||
|
SAX2.c | 11 +++++++----
|
||||||
|
parser.c | 5 +----
|
||||||
|
2 files changed, 8 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/SAX2.c b/SAX2.c
|
||||||
|
index b6be1a6c4..910193892 100644
|
||||||
|
--- a/SAX2.c
|
||||||
|
+++ b/SAX2.c
|
||||||
|
@@ -2874,20 +2874,23 @@ xmlSAXVersion(xmlSAXHandler *hdlr, int version)
|
||||||
|
{
|
||||||
|
if (hdlr == NULL) return(-1);
|
||||||
|
if (version == 2) {
|
||||||
|
- hdlr->startElement = NULL;
|
||||||
|
- hdlr->endElement = NULL;
|
||||||
|
hdlr->startElementNs = xmlSAX2StartElementNs;
|
||||||
|
hdlr->endElementNs = xmlSAX2EndElementNs;
|
||||||
|
hdlr->serror = NULL;
|
||||||
|
hdlr->initialized = XML_SAX2_MAGIC;
|
||||||
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
|
} else if (version == 1) {
|
||||||
|
- hdlr->startElement = xmlSAX2StartElement;
|
||||||
|
- hdlr->endElement = xmlSAX2EndElement;
|
||||||
|
hdlr->initialized = 1;
|
||||||
|
#endif /* LIBXML_SAX1_ENABLED */
|
||||||
|
} else
|
||||||
|
return(-1);
|
||||||
|
+#ifdef LIBXML_SAX1_ENABLED
|
||||||
|
+ hdlr->startElement = xmlSAX2StartElement;
|
||||||
|
+ hdlr->endElement = xmlSAX2EndElement;
|
||||||
|
+#else
|
||||||
|
+ hdlr->startElement = NULL;
|
||||||
|
+ hdlr->endElement = NULL;
|
||||||
|
+#endif /* LIBXML_SAX1_ENABLED */
|
||||||
|
hdlr->internalSubset = xmlSAX2InternalSubset;
|
||||||
|
hdlr->externalSubset = xmlSAX2ExternalSubset;
|
||||||
|
hdlr->isStandalone = xmlSAX2IsStandalone;
|
||||||
|
diff --git a/parser.c b/parser.c
|
||||||
|
index 0c8bed129..e133fe0a6 100644
|
||||||
|
--- a/parser.c
|
||||||
|
+++ b/parser.c
|
||||||
|
@@ -842,10 +842,7 @@ xmlDetectSAX2(xmlParserCtxtPtr ctxt) {
|
||||||
|
if (ctxt == NULL) return;
|
||||||
|
sax = ctxt->sax;
|
||||||
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
|
- if ((sax) && (sax->initialized == XML_SAX2_MAGIC) &&
|
||||||
|
- ((sax->startElementNs != NULL) ||
|
||||||
|
- (sax->endElementNs != NULL) ||
|
||||||
|
- ((sax->startElement == NULL) && (sax->endElement == NULL))))
|
||||||
|
+ if ((sax) && (sax->initialized == XML_SAX2_MAGIC))
|
||||||
|
ctxt->sax2 = 1;
|
||||||
|
#else
|
||||||
|
ctxt->sax2 = 1;
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
Summary: Library providing XML and HTML support
|
Summary: Library providing XML and HTML support
|
||||||
Name: libxml2
|
Name: libxml2
|
||||||
Version: 2.9.14
|
Version: 2.9.14
|
||||||
Release: 7
|
Release: 8
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
Source: https://download.gnome.org/sources/%{name}/2.9/%{name}-%{version}.tar.xz
|
Source: https://download.gnome.org/sources/%{name}/2.9/%{name}-%{version}.tar.xz
|
||||||
@ -187,6 +187,7 @@ Patch6166: backport-Fix-use-after-free-in-xmlParseContentInternal.patch
|
|||||||
Patch6167: backport-malloc-fail-Fix-null-deref-after-xmlXIncludeNewRef.patch
|
Patch6167: backport-malloc-fail-Fix-null-deref-after-xmlXIncludeNewRef.patch
|
||||||
|
|
||||||
Patch6168: backport-xpath-Ignore-entity-ref-nodes-when-computing-node-ha.patch
|
Patch6168: backport-xpath-Ignore-entity-ref-nodes-when-computing-node-ha.patch
|
||||||
|
Patch6169: backport-SAX-Always-initialize-SAX1-element-handlers.patch
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
@ -342,6 +343,9 @@ rm -fr %{buildroot}
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 01 2023 liningjie <liningjie@xfusion.com> - 2.9.14-8
|
||||||
|
- SAX: Always initialize SAX1 element handlers
|
||||||
|
|
||||||
* Mon Jun 19 2023 zhuofeng <zhuofeng2@huawei.com> - 2.9.14-7
|
* Mon Jun 19 2023 zhuofeng <zhuofeng2@huawei.com> - 2.9.14-7
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user