]> granicus.if.org Git - imagemagick/commitdiff
Ensure enough samples for RGB or CMYK TIFF images with an alpha channel
authorCristy <urban-warrior@imagemagick.org>
Thu, 2 Mar 2017 02:08:21 +0000 (21:08 -0500)
committerCristy <urban-warrior@imagemagick.org>
Thu, 2 Mar 2017 02:08:21 +0000 (21:08 -0500)
coders/tiff.c

index b1a9f96185801e3d08f5e3e1f6e7e14eb48647a7..edb5763437bc88bcdb69e29ff0237fa00a4e31f6 100644 (file)
@@ -1591,9 +1591,13 @@ RestoreMSCWarning
         (void) SetImageProperty(image,"tiff:rows-per-strip",value,exception);
       }
     if ((samples_per_pixel >= 3) && (interlace == PLANARCONFIG_CONTIG))
-      method=ReadRGBAMethod;
+      if ((image->alpha_trait == UndefinedPixelTrait) ||
+          (samples_per_pixel >= 4))
+        method=ReadRGBAMethod;
     if ((samples_per_pixel >= 4) && (interlace == PLANARCONFIG_SEPARATE))
-      method=ReadCMYKAMethod;
+      if ((image->alpha_trait == UndefinedPixelTrait) ||
+          (samples_per_pixel >= 5))
+        method=ReadCMYKAMethod;
     if ((photometric != PHOTOMETRIC_RGB) &&
         (photometric != PHOTOMETRIC_CIELAB) &&
         (photometric != PHOTOMETRIC_SEPARATED))