about summary refs log tree commit diff
path: root/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-09-08 00:46:04 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-09-08 00:46:04 +0000
commitb3c523f23f5c7e3777d0cbb4094737da84b0fa90 (patch)
tree23f0534b7d57d1d7486a33503af06fdde35b0089 /other
parentdaa072c5aaf1a04922396943dc312b6ac2d9faf1 (diff)
downloadnetpbm-mirror-b3c523f23f5c7e3777d0cbb4094737da84b0fa90.tar.gz
netpbm-mirror-b3c523f23f5c7e3777d0cbb4094737da84b0fa90.tar.xz
netpbm-mirror-b3c523f23f5c7e3777d0cbb4094737da84b0fa90.zip
Fix crash with -compare of BLACKANDWHITE PAMs
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3954 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'other')
-rw-r--r--other/pamarith.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/other/pamarith.c b/other/pamarith.c
index 12c102b3..c67c7326 100644
--- a/other/pamarith.c
+++ b/other/pamarith.c
@@ -4,6 +4,7 @@
 
 #include "pm_c_util.h"
 #include "mallocvar.h"
+#include "nstring.h"
 #include "shhopt.h"
 #include "pam.h"
 
@@ -289,7 +290,11 @@ computeOutputType(struct pam *  const outpamP,
         outpamP->maxval = inpam1.maxval;
     }
     outpamP->bytes_per_sample = (pm_maxvaltobits(outpamP->maxval)+7)/8;
-    strcpy(outpamP->tuple_type, inpam1.tuple_type);
+
+    if (outpamP->maxval > 1 && strneq(inpam1.tuple_type, "BLACKANDWHITE", 13))
+        strcpy(outpamP->tuple_type, "");
+    else
+        strcpy(outpamP->tuple_type, inpam1.tuple_type);
 }