1From 457fc622d5e8e3734d9c294c81d6c1babb9c5dd5 Mon Sep 17 00:00:00 2001 2From: Nick Wellnhofer <wellnhofer@aevum.de> 3Date: Mon, 13 Mar 2023 16:51:14 +0100 4Subject: [PATCH] malloc-fail: Fix null deref in xmlParserInputShrink 5 6Found by OSS-Fuzz. 7 8Reference:https://github.com/GNOME/libxml2/commit/457fc622d5e8e3734d9c294c81d6c1babb9c5dd5 9Conflict:NA 10 11--- 12 parserInternals.c | 7 +++++++ 13 1 file changed, 7 insertions(+) 14 15diff --git a/parserInternals.c b/parserInternals.c 16index dd1dc9c..08d8d55 100644 17--- a/parserInternals.c 18+++ b/parserInternals.c 19@@ -380,6 +380,13 @@ xmlParserInputShrink(xmlParserInputPtr in) { 20 } 21 22 in->base = xmlBufContent(in->buf->buffer); 23+ if (in->base == NULL) { 24+ /* TODO: raise error */ 25+ in->base = BAD_CAST ""; 26+ in->cur = in->base; 27+ in->end = in->base; 28+ return; 29+ } 30 in->cur = in->base + used; 31 in->end = xmlBufEnd(in->buf->buffer); 32 33-- 342.27.0 35 36