1 Star 0 Fork 52

冉召宇/third_party_libxml2_1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
backport-xpath-Ignore-entity-ref-nodes-when-computing-node-ha.patch 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
冉召宇 提交于 11个月前 . libxml2切openEuler7.0
From 6273df6c6d84b6be8a62a62abf1d9b79cc2035f8 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 30 May 2023 12:30:27 +0200
Subject: [PATCH] xpath: Ignore entity ref nodes when computing node hash
XPath queries only work reliably if entities are substituted.
Nevertheless, it's possible to query a document with entity reference
nodes. xmllint even deletes entities when the `--dropdtd` option is
passed, resulting in dangling pointers, so it's best to skip entity
reference nodes to avoid a use-after-free.
Fixes #550.
Reference:https://github.com/GNOME/libxml2/commit/6273df6c6d84b6be8a62a62abf1d9b79cc2035f8
Conflict:NA
---
xpath.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/xpath.c b/xpath.c
index 3d1ca71..3128efb 100644
--- a/xpath.c
+++ b/xpath.c
@@ -6396,11 +6396,12 @@ xmlXPathNodeValHash(xmlNodePtr node) {
/*
* Skip to next node
*/
- if ((tmp->children != NULL) && (tmp->type != XML_DTD_NODE)) {
- if (tmp->children->type != XML_ENTITY_DECL) {
- tmp = tmp->children;
- continue;
- }
+ if ((tmp->children != NULL) &&
+ (tmp->type != XML_DTD_NODE) &&
+ (tmp->type != XML_ENTITY_REF_NODE) &&
+ (tmp->children->type != XML_ENTITY_DECL)) {
+ tmp = tmp->children;
+ continue;
}
if (tmp == node)
break;
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ran-zhao-yu/third_party_libxml2_1.git
git@gitee.com:ran-zhao-yu/third_party_libxml2_1.git
ran-zhao-yu
third_party_libxml2_1
third_party_libxml2_1
master

搜索帮助