libxml2/backport-malloc-fail-Fix-null-deref-in-xmlSchemaValAtomicType.patch
zhuofeng feb7e8218d backport upstream patches
(cherry picked from commit ec64ed27a9add0f7a9bf6ee351ad67302a60c383)
2023-06-20 11:16:46 +08:00

30 lines
944 B
Diff

From 7762e8eda184bc755dcc3c2d4aed259f95670ccd Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 5 Mar 2023 14:08:15 +0100
Subject: [PATCH] malloc-fail: Fix null deref in xmlSchemaValAtomicType
Found with libFuzzer, see #344.
Reference:https://github.com/GNOME/libxml2/commit/7762e8eda184bc755dcc3c2d4aed259f95670ccd
Conflict:NA
---
xmlschemastypes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index ebb0219..d4864b7 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -3033,6 +3033,8 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
value = norm;
}
tmpval = xmlStrdup(value);
+ if (tmpval == NULL)
+ goto error;
for (cur = tmpval; *cur; ++cur) {
if (*cur < 32 || *cur >= 127 || *cur == ' ' ||
*cur == '<' || *cur == '>' || *cur == '"' ||
--
2.27.0