From 25710439b4d0a2dafc59bf00305f197aeded1eed Mon Sep 17 00:00:00 2001
From: jakelodwick <jakelodwick@gmail.com>
Date: Sat, 28 Feb 2026 16:17:20 -0800
Subject: [PATCH] Add overflow check to sixel write path

---
 coders/sixel.c | 2 ++
 1 file changed, 2 insertions(+)

Index: ImageMagick-7.1.1-43/coders/sixel.c
===================================================================
--- ImageMagick-7.1.1-43.orig/coders/sixel.c
+++ ImageMagick-7.1.1-43/coders/sixel.c
@@ -801,6 +801,8 @@ static MagickBooleanType sixel_encode_im
   context->pos = 0;
   if (ncolors < 1)
     return(MagickFalse);
+  if (HeapOverflowSanityCheck(ncolors,width) != MagickFalse)
+    return(MagickFalse);
   len=ncolors*width;
   context->active_palette=(-1);
   map=(sixel_pixel_t *) AcquireQuantumMemory(len,sizeof(sixel_pixel_t));
