代码拉取完成,页面将自动刷新
From a3749551e65a8caf146ea2bccf610e718d90bde0 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Fri, 3 Feb 2023 14:00:13 +0100
Subject: [PATCH] malloc-fail: Fix reallocation in xmlXIncludeNewRef
Avoid null deref.
Found with libFuzzer, see #344.
Reference:https://github.com/GNOME/libxml2/commit/a3749551e65a8caf146ea2bccf610e718d90bde0
Conflict:xinclude.c
---
xinclude.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/xinclude.c b/xinclude.c
index 60a0d7b..cc486f5 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -257,14 +257,18 @@ xmlXIncludeNewRef(xmlXIncludeCtxtPtr ctxt, const xmlChar *URI,
}
}
if (ctxt->incNr >= ctxt->incMax) {
- ctxt->incMax *= 2;
- ctxt->incTab = (xmlXIncludeRefPtr *) xmlRealloc(ctxt->incTab,
- ctxt->incMax * sizeof(ctxt->incTab[0]));
- if (ctxt->incTab == NULL) {
+ xmlXIncludeRefPtr *tmp;
+ size_t newSize = ctxt->incMax * 2;
+
+ tmp = (xmlXIncludeRefPtr *) xmlRealloc(ctxt->incTab,
+ newSize * sizeof(ctxt->incTab[0]));
+ if (tmp == NULL) {
xmlXIncludeErrMemory(ctxt, ref, "growing XInclude context");
xmlXIncludeFreeRef(ret);
return(NULL);
}
+ ctxt->incTab = tmp;
+ ctxt->incMax *= 2;
}
ctxt->incTab[ctxt->incNr++] = ret;
return(ret);
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。