From: Tony Cook <tony@develop=help.com>
Date: Mon, 31 Oct 2005 04:47:08 +0000 (+0000)
Subject: - maxcolors now must be at least 1 when creating a paletted image.
X-Git-Tag: Imager-0.48^2~99
X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/d443d6bec0526dde2030f747b5a2634b6f6f56fc

- maxcolors now must be at least 1 when creating a paletted image.
---

diff --git a/Changes b/Changes
index 731333d9..4b306ab6 100644
--- a/Changes
+++ b/Changes
@@ -1162,6 +1162,7 @@ Revision history for Perl extension Imager.
 - you can now supply a page parameter to read() to read a given page
   from a GIF file.
 - reading a multi-image GIF was leaking memory (a line buffer per file)
+- maxcolors now must be at least 1 when creating a paletted image.
 
 =================================================================
 
diff --git a/palimg.c b/palimg.c
index 1667238e..886697b6 100644
--- a/palimg.c
+++ b/palimg.c
@@ -87,7 +87,7 @@ i_img *i_img_pal_new_low(i_img *im, int x, int y, int channels, int maxpal) {
   int bytes;
 
   i_clear_error();
-  if (maxpal < 0 || maxpal > 256) {
+  if (maxpal < 1 || maxpal > 256) {
     i_push_error(0, "Maximum of 256 palette entries");
     return NULL;
   }