about summary refs log tree commit diff
path: root/converter/other/pnmtopalm/palmtopnm.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-09-28 01:24:37 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-09-28 01:24:37 +0000
commitfd89b0bdc07ab7da700fcfeffd4093549e2ff5c2 (patch)
tree916cf669061d89f0ce7331a45d099cc30e7f86a8 /converter/other/pnmtopalm/palmtopnm.c
parent1472db408ce70f13c4423a58dfe47f023ef0dd5f (diff)
downloadnetpbm-mirror-fd89b0bdc07ab7da700fcfeffd4093549e2ff5c2.tar.gz
netpbm-mirror-fd89b0bdc07ab7da700fcfeffd4093549e2ff5c2.tar.xz
netpbm-mirror-fd89b0bdc07ab7da700fcfeffd4093549e2ff5c2.zip
Release 10.47.66
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3077 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pnmtopalm/palmtopnm.c')
-rw-r--r--converter/other/pnmtopalm/palmtopnm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/converter/other/pnmtopalm/palmtopnm.c b/converter/other/pnmtopalm/palmtopnm.c
index 88088817..e686571b 100644
--- a/converter/other/pnmtopalm/palmtopnm.c
+++ b/converter/other/pnmtopalm/palmtopnm.c
@@ -688,6 +688,11 @@ doTransparent(FILE *                 const ofP,
                                                colormap->ncolors,
                                                sizeof(color), 
                                                palmcolor_compare_indices));
+            if (!actualColor)
+                pm_error("Invalid input; transparent index %u "
+                         "is not among the %u colors in the image's colormap",
+                         transparentIndex, colormap->ncolors);
+
             fprintf(ofP, "#%02x%02x%02x\n", 
                    (unsigned int) ((*actualColor >> 16) & 0xFF),
                    (unsigned int) ((*actualColor >>  8) & 0xFF), 
@@ -1020,6 +1025,12 @@ convertRowToPnmNotDirect(const unsigned char * const palmrow,
                                                   colormap->ncolors,
                                                   sizeof(color2), 
                                                   palmcolor_compare_indices));
+            if (!actualColor)
+                pm_error("Invalid input.  A color index in column %u "
+                         "is %u, which is not among the %u colors "
+                         "in the colormap",
+                         j, color, colormap->ncolors);
+
             PPM_ASSIGN(xelrow[j], 
                        (*actualColor >> 16) & 0xFF, 
                        (*actualColor >>  8) & 0xFF,