-
-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: apply upstream patch for in-context parsing (#3116)
**What problem is this PR intended to solve?** Apply upstream fix for #3112 - upstream bug report https://gitlab.gnome.org/GNOME/libxml2/-/issues/672 - upstream fix https://gitlab.gnome.org/GNOME/libxml2/-/commit/95f2a17440568694a6df6a326c5b411e77597be2 Fixes #3112 **Have you included adequate test coverage?** Yes **Does this change affect the behavior of either the C or the Java implementations?** Only affects the C implementation.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
patches/libxml2/0012-parser-Fix-crash-in-xmlParseInNodeContext-with-HTML.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
From 95f2a17440568694a6df6a326c5b411e77597be2 Mon Sep 17 00:00:00 2001 | ||
From: Nick Wellnhofer <[email protected]> | ||
Date: Tue, 30 Jan 2024 13:25:17 +0100 | ||
Subject: [PATCH] parser: Fix crash in xmlParseInNodeContext with HTML | ||
documents | ||
|
||
Ignore namespaces if we have an HTML document with namespaces added | ||
manually. | ||
|
||
Fixes #672. | ||
--- | ||
parser.c | 4 +++- | ||
1 file changed, 3 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/parser.c b/parser.c | ||
index 1038d71b..f7842ed1 100644 | ||
--- a/parser.c | ||
+++ b/parser.c | ||
@@ -12415,8 +12415,10 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, | ||
} | ||
xmlAddChild(node, fake); | ||
|
||
- if (node->type == XML_ELEMENT_NODE) { | ||
+ if (node->type == XML_ELEMENT_NODE) | ||
nodePush(ctxt, node); | ||
+ | ||
+ if ((ctxt->html == 0) && (node->type == XML_ELEMENT_NODE)) { | ||
/* | ||
* initialize the SAX2 namespaces stack | ||
*/ | ||
-- | ||
2.42.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters