• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From bd9de3a31f66bbf38b2e90cc9efb1374cc1314da Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Sun, 22 Jan 2023 16:52:39 +0100
4Subject: [PATCH] malloc-fail: Fix null deref in xmlAddDefAttrs
5
6Found with libFuzzer, see #344.
7
8Reference:https://github.com/GNOME/libxml2/commit/bd9de3a31f66bbf38b2e90cc9efb1374cc1314da
9Conflict:NA
10---
11 parser.c | 2 ++
12 1 file changed, 2 insertions(+)
13
14diff --git a/parser.c b/parser.c
15index fafae15..3c06439 100644
16--- a/parser.c
17+++ b/parser.c
18@@ -1334,6 +1334,8 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt,
19     /* intern the string and precompute the end */
20     len = xmlStrlen(value);
21     value = xmlDictLookup(ctxt->dict, value, len);
22+    if (value == NULL)
23+        goto mem_error;
24     defaults->values[5 * defaults->nbAttrs + 2] = value;
25     defaults->values[5 * defaults->nbAttrs + 3] = value + len;
26     if (ctxt->external)
27--
282.27.0
29
30