about summary refs log tree commit diff
path: root/generator
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-01-05 03:44:32 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-01-05 03:44:32 +0000
commit4d797dc32c3142447fb51ce1fed91c36f78b11cf (patch)
tree45ccd030d0b7d1e265460d745ed0db7808075b57 /generator
parente8d2b2d42f8d89ff3828f7d0e77474af56672942 (diff)
downloadnetpbm-mirror-4d797dc32c3142447fb51ce1fed91c36f78b11cf.tar.gz
netpbm-mirror-4d797dc32c3142447fb51ce1fed91c36f78b11cf.tar.xz
netpbm-mirror-4d797dc32c3142447fb51ce1fed91c36f78b11cf.zip
Fix bug: -camo, -anticamo without -color assertion failure because of incorrect
check for user-specified color table.


git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3107 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'generator')
-rw-r--r--generator/ppmpat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/generator/ppmpat.c b/generator/ppmpat.c
index f1452fc7..908c200f 100644
--- a/generator/ppmpat.c
+++ b/generator/ppmpat.c
@@ -581,6 +581,7 @@ camoFill(pixel **         const pixels,
     pixel color;
 
     if (colorTableP->count > 0) {
+        assert(colorTableP->index < colorTableP->count);
         color = colorTableP->color[colorTableP->index];
         nextColorBg(colorTableP);
     } else if (antiflag)
@@ -650,7 +651,7 @@ camo(pixel **     const pixels,
 
     clearBackgroundCamo(pixels, cols, rows, maxval, colorTableP, antiflag);
 
-    if (colorTableP) {
+    if (colorTableP->count > 0) {
         assert(colorTableP->count > 1);
         colorTableP->index = 1;  /* Foreground colors start at 1 */
     }