Commit 28c1eb3bd for imagemagick.org

commit 28c1eb3bd37c99d09fa3d3780004be373809d59e
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Fri Oct 16 19:23:42 2026 -0400

    https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-gr4q-6v79-qj3g

diff --git a/coders/gif.c b/coders/gif.c
index 557963644..fe0a81099 100644
--- a/coders/gif.c
+++ b/coders/gif.c
@@ -665,7 +665,7 @@ static MagickBooleanType EncodeImage(const ImageInfo *image_info,Image *image,
       break;
     if (y == 0)
       {
-        waiting_code=(short) GetPixelIndex(image,p);
+        waiting_code=(short) (((size_t) GetPixelIndex(image,p)) & 0xff);
         p+=(ptrdiff_t) GetPixelChannels(image);
       }
     for (x=(ssize_t) (y == 0 ? 1 : 0); x < (ssize_t) image->columns; x++)
@@ -678,8 +678,8 @@ static MagickBooleanType EncodeImage(const ImageInfo *image_info,Image *image,
       index=(Quantum) ((size_t) GetPixelIndex(image,p) & 0xff);
       p+=(ptrdiff_t) GetPixelChannels(image);
       k=(ssize_t) (((size_t) index << (MaxGIFBits-8))+(size_t) waiting_code);
-      if (k >= MaxHashTable)
-        k-=MaxHashTable;
+      if (k >= 0)
+        k%=MaxHashTable;
       if (k < 0)
         continue;
       if (hash_code[k] > 0)
diff --git a/coders/miff.c b/coders/miff.c
index 5f8bd4a92..41b0cc287 100644
--- a/coders/miff.c
+++ b/coders/miff.c
@@ -1386,7 +1386,8 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
         if (image->alpha_trait != UndefinedPixelTrait)
           quantum_type=IndexAlphaQuantum;
       }
-    if (image->number_meta_channels != 0)
+    if ((image->number_meta_channels != 0) &&
+        (image->storage_class != PseudoClass))
       quantum_type=MultispectralQuantum;
     status=MagickTrue;
     GetPixelInfo(image,&pixel);
diff --git a/coders/tiff.c b/coders/tiff.c
index 6b5b7d643..2ebc4702d 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -1762,7 +1762,8 @@ static Image *ReadTIFFImageInternal(const ImageInfo *image_info,
     image_quantum_type=GrayQuantum;
     if (image->storage_class == PseudoClass)
       image_quantum_type=IndexQuantum;
-    if (image->number_meta_channels != 0)
+    if ((image->number_meta_channels != 0) &&
+        (image->storage_class != PseudoClass))
       {
         image_quantum_type=MultispectralQuantum;
         (void) SetQuantumPad(image,quantum_info,0);