5 Star 6 Fork 47

OpenHarmony/third_party_libxml2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
backport-parser-Fix-push-parser-with-1-3-byte-initial-chunk.patch 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
冉召宇 提交于 2024-04-25 19:13 . libxml2切openEuler7.0
From e2d37972e41224b11ff76f3a9fd689207b6108a6 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <[email protected]>
Date: Sun, 20 Nov 2022 15:35:49 +0100
Subject: [PATCH 21/28] parser: Fix push parser with 1-3 byte initial chunk
Make sure that ctxt->charset is initialized properly.
Reference: https://github.com/GNOME/libxml2/commit/55fb8f72ac726b4f760136070e0d2093ffcdb3ac
Conflict: NA
---
parser.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/parser.c b/parser.c
index 7553f86..4615db0 100644
--- a/parser.c
+++ b/parser.c
@@ -12523,9 +12523,10 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
* the encoding, we set the context to XML_CHAR_ENCODING_NONE so
* that it can be automatically determined later
*/
- if ((size == 0) || (chunk == NULL)) {
- ctxt->charset = XML_CHAR_ENCODING_NONE;
- } else if ((ctxt->input != NULL) && (ctxt->input->buf != NULL)) {
+ ctxt->charset = XML_CHAR_ENCODING_NONE;
+
+ if ((size != 0) && (chunk != NULL) &&
+ (ctxt->input != NULL) && (ctxt->input->buf != NULL)) {
size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input);
size_t cur = ctxt->input->cur - ctxt->input->base;
--
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

搜索帮助