From d27b840a61b322419a66d0d192ff56d52498148d Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Tue, 24 Mar 2026 08:02:57 -0400
Subject: [PATCH] 
 https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-v67w-737x-v2c9

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

diff --git a/coders/viff.c b/coders/viff.c
index 595941f11aa..dbdff71c4ba 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -1098,6 +1098,8 @@ static MagickBooleanType WriteVIFFImage(const ImageInfo *image_info,
     /*
       Convert MIFF to VIFF raster pixels.
     */
+    if (packets != (MagickSizeType) ((size_t) packets))
+      ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     pixel_info=AcquireVirtualMemory((size_t) packets,sizeof(*pixels));
     if (pixel_info == (MemoryInfo *) NULL)
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");

