5 Star 6 Fork 47

OpenHarmony/third_party_libxml2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
backport-parser-Fix-OOB-read-when-formatting-error-message.patch 953 Bytes
一键复制 编辑 原始数据 按行查看 历史
冉召宇 提交于 2024-04-25 19:13 . libxml2切openEuler7.0
From 5d55315e32b34af7070d38060ccf9a60941b9696 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <[email protected]>
Date: Sat, 18 Feb 2023 17:29:07 +0100
Subject: [PATCH] parser: Fix OOB read when formatting error message
Don't try to print characters beyond the end of the buffer.
Found by OSS-Fuzz.
Reference:https://github.com/GNOME/libxml2/commit/5d55315e32b34af7070d38060ccf9a60941b9696
Conflict:NA
---
parser.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/parser.c b/parser.c
index 37d7dec..c276a1a 100644
--- a/parser.c
+++ b/parser.c
@@ -12162,7 +12162,11 @@ done:
#endif
return(ret);
encoding_error:
- {
+ if (ctxt->input->end - ctxt->input->cur < 4) {
+ __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR,
+ "Input is not proper UTF-8, indicate encoding !\n",
+ NULL, NULL);
+ } else {
char buffer[150];
snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/third_party_libxml2.git
[email protected]:openharmony/third_party_libxml2.git
openharmony
third_party_libxml2
third_party_libxml2
master

搜索帮助