代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/third_party_libxml2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 4499143a8737148b9be4e3c05e71bc60c5b52e4f Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 26 Feb 2023 15:43:50 +0100
Subject: [PATCH] malloc-fail: Check for malloc failure in xmlHashAddEntry
Found with libFuzzer, see #344.
Reference:https://github.com/GNOME/libxml2/commit/4499143a8737148b9be4e3c05e71bc60c5b52e4f
Conflict:NA
---
hash.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 50 insertions(+), 4 deletions(-)
diff --git a/hash.c b/hash.c
index 7b82d2f..00250ba 100644
--- a/hash.c
+++ b/hash.c
@@ -614,8 +614,24 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
entry->name3 = (xmlChar *) name3;
} else {
entry->name = xmlStrdup(name);
- entry->name2 = xmlStrdup(name2);
- entry->name3 = xmlStrdup(name3);
+ if (entry->name == NULL) {
+ entry->name2 = NULL;
+ goto error;
+ }
+ if (name2 == NULL) {
+ entry->name2 = NULL;
+ } else {
+ entry->name2 = xmlStrdup(name2);
+ if (entry->name2 == NULL)
+ goto error;
+ }
+ if (name3 == NULL) {
+ entry->name3 = NULL;
+ } else {
+ entry->name3 = xmlStrdup(name3);
+ if (entry->name3 == NULL)
+ goto error;
+ }
}
entry->payload = userdata;
entry->next = NULL;
@@ -631,6 +647,13 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
xmlHashGrow(table, MAX_HASH_LEN * table->size);
return(0);
+
+error:
+ xmlFree(entry->name2);
+ xmlFree(entry->name);
+ if (insert != NULL)
+ xmlFree(entry);
+ return(-1);
}
/**
@@ -744,8 +767,24 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
entry->name3 = (xmlChar *) name3;
} else {
entry->name = xmlStrdup(name);
- entry->name2 = xmlStrdup(name2);
- entry->name3 = xmlStrdup(name3);
+ if (entry->name == NULL) {
+ entry->name2 = NULL;
+ goto error;
+ }
+ if (name2 == NULL) {
+ entry->name2 = NULL;
+ } else {
+ entry->name2 = xmlStrdup(name2);
+ if (entry->name2 == NULL)
+ goto error;
+ }
+ if (name3 == NULL) {
+ entry->name3 = NULL;
+ } else {
+ entry->name3 = xmlStrdup(name3);
+ if (entry->name3 == NULL)
+ goto error;
+ }
}
entry->payload = userdata;
entry->next = NULL;
@@ -757,6 +796,13 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
insert->next = entry;
}
return(0);
+
+error:
+ xmlFree(entry->name2);
+ xmlFree(entry->name);
+ if (insert != NULL)
+ xmlFree(entry);
+ return(-1);
}
/**
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。