1 Star 0 Fork 48

冉召宇/third_party_libxml2_1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
backport-io-Check-for-memory-buffer-early-in-xmlParserInputGrow.patch 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
冉召宇 提交于 2024-04-25 19:13 . libxml2切openEuler7.0
From 9feafbc5c5cce13852062a527d719ecce6b54661 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 13 Nov 2022 16:56:10 +0100
Subject: [PATCH] io: Check for memory buffer early in xmlParserInputGrow
Reference:https://github.com/GNOME/libxml2/commit/9feafbc5c5cce13852062a527d719ecce6b54661
Conflict:NA
---
parserInternals.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/parserInternals.c b/parserInternals.c
index b8eab4b..0ef44fe 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -310,6 +310,9 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
if (in->cur == NULL) return(-1);
if (in->buf->buffer == NULL) return(-1);
+ /* Don't grow memory buffers. */
+ if (in->buf->readcallback == NULL) return(0);
+
CHECK_BUFFER(in);
indx = in->cur - in->base;
@@ -319,10 +322,7 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
return(0);
}
- if (in->buf->readcallback != NULL) {
- ret = xmlParserInputBufferGrow(in->buf, len);
- } else
- return(0);
+ ret = xmlParserInputBufferGrow(in->buf, len);
in->base = xmlBufContent(in->buf->buffer);
in->cur = in->base + indx;
--
2.27.0
马建仓 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

搜索帮助