]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 21 Dec 2014 23:32:29 +0000 (23:32 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 21 Dec 2014 23:32:29 +0000 (23:32 +0000)
MagickCore/colormap-private.h

index f54c50a093d1444022f64d033c8afb7ea987123e..1dfce223559e107829bf0cf6453ac3b5b7546625 100644 (file)
@@ -38,6 +38,20 @@ static inline ssize_t ConstrainColormapIndex(Image *image,const ssize_t index,
   return((ssize_t) index);
 }
 
+static inline MagickBooleanType IsValidColormapIndex(Image *image,
+  const ssize_t index,Quantum *target,ExceptionInfo *exception)
+{ 
+  if ((index < 0) || (index >= (ssize_t) image->colors))
+    { 
+      (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
+        "InvalidColormapIndex","`%s'",image->filename);
+      *target=(Quantum) 0;
+      return(MagickFalse);
+    }
+  *target=(Quantum) index;
+  return(MagickTrue);
+}
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif