代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/third_party_libxml2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From d038d7177668030f0c54fa1772d3f174cf6527f1 Mon Sep 17 00:00:00 2001
From: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Date: Thu, 1 Dec 2022 12:58:11 +0000
Subject: [PATCH 26/28] Correctly relocate internal pointers after realloc()
Adding an offset to a deallocated pointer and assuming that it can be
dereferenced is undefined behaviour. When running libxml2 on CHERI-enabled
systems such as Arm Morello this results in the creation of an out-of-bounds
pointer that cannot be dereferenced and therefore crashes at runtime.
The effect of this UB is not just limited to architectures such as CHERI,
incorrect relocation of pointers after realloc can in fact cause
FORTIFY_SOURCE errors with recent GCC:
https://developers.redhat.com/articles/2022/09/17/gccs-new-fortification-level
Reference: https://github.com/GNOME/libxml2/commit/c62c0d82ccacc2000c45f211166f008687fb97a0
Conflict: NA
---
parser.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/parser.c b/parser.c
index 9d50138..adc449c 100644
--- a/parser.c
+++ b/parser.c
@@ -9514,10 +9514,10 @@ next_attr:
* Arithmetic on dangling pointers is technically undefined
* behavior, but well...
*/
- ptrdiff_t offset = ctxt->input->base - atts[i+2];
+ const xmlChar *old = atts[i+2];
atts[i+2] = NULL; /* Reset repurposed namespace URI */
- atts[i+3] += offset; /* value */
- atts[i+4] += offset; /* valuend */
+ atts[i+3] = ctxt->input->base + (atts[i+3] - old); /* value */
+ atts[i+4] = ctxt->input->base + (atts[i+4] - old); /* valuend */
}
}
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。