From 4a4fb2131c48b912b762a0c9915a2d717de7132a Mon Sep 17 00:00:00 2001
From: "Eric S. Raymond" <esr@thyrsus.com>
Date: Wed, 10 Jun 2026 17:00:29 -0400
Subject: [PATCH 3/3] Resolve ticket #203: GifUnionColorMap NULL Pointer
 Dereference

---
 gifalloc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gifalloc.c b/gifalloc.c
index 886907d..e36684b 100644
--- a/gifalloc.c
+++ b/gifalloc.c
@@ -114,6 +114,10 @@ ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1,
 	int i, j, CrntSlot, RoundUpTo, NewGifBitSize;
 	ColorMapObject *ColorUnion;
 
+	if (ColorIn1 == NULL || ColorIn2 == NULL) {
+		return (NULL);
+	}
+
 	/*
 	 * We don't worry about duplicates within either color map; if
 	 * the caller wants to resolve those, he can perform unions
-- 
2.55.0

