about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile.version2
-rw-r--r--converter/other/Makefile6
-rw-r--r--converter/other/pnmtopalm/pnmtopalm.c2
-rw-r--r--converter/pbm/pbmtonokia.c15
-rw-r--r--doc/HISTORY21
-rw-r--r--lib/libpam.c23
-rw-r--r--lib/libppm1.c3
-rw-r--r--other/pamstack.c16
8 files changed, 69 insertions, 19 deletions
diff --git a/Makefile.version b/Makefile.version
index f0a02711..7a239841 100644
--- a/Makefile.version
+++ b/Makefile.version
@@ -1,4 +1,4 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 39
-NETPBM_POINT_RELEASE = 04
+NETPBM_POINT_RELEASE = 05
 
diff --git a/converter/other/Makefile b/converter/other/Makefile
index 09a3e298..3b6d8288 100644
--- a/converter/other/Makefile
+++ b/converter/other/Makefile
@@ -86,9 +86,13 @@ PORTBINARIES =  bmptopnm fitstopnm \
 		pbmtopgm pfmtopam \
 	        pgmtopbm pgmtoppm ppmtopgm pnmtoddif \
 		pnmtopclxl \
-		pnmtosgi pnmtosir pamtotga pnmtoxwd pstopnm \
+		pnmtosgi pnmtosir pamtotga pnmtoxwd \
 		rlatopam sgitopnm sirtopnm xwdtopnm zeisstopnm
 
+ifneq ($(DONT_HAVE_PROCESS_MGMT),Y)
+  PORTBINARIES += pstopnm
+endif
+
 BINARIES = $(PORTBINARIES) pnmtorast rasttopnm
 
 ifeq ($(HAVE_PNGLIB),Y)
diff --git a/converter/other/pnmtopalm/pnmtopalm.c b/converter/other/pnmtopalm/pnmtopalm.c
index 3b9eec8f..f5f6e44a 100644
--- a/converter/other/pnmtopalm/pnmtopalm.c
+++ b/converter/other/pnmtopalm/pnmtopalm.c
@@ -365,7 +365,7 @@ writeCommonHeader(unsigned int         const cols,
         pm_error("Too many columns for Palm Bitmap: %u", cols);
     pm_writebigshort(stdout, cols);    /* width */
     if (rows > USHRT_MAX)
-        pm_error("Too many columns for Palm Bitmap: %u", rows);
+        pm_error("Too many rows for Palm Bitmap: %u", rows);
     pm_writebigshort(stdout, rows);    /* height */
     if (rowbytes > USHRT_MAX)
         pm_error("Too many bytes per row for Palm Bitmap: %u", rowbytes);
diff --git a/converter/pbm/pbmtonokia.c b/converter/pbm/pbmtonokia.c
index 3c47eac3..58d0ec5b 100644
--- a/converter/pbm/pbmtonokia.c
+++ b/converter/pbm/pbmtonokia.c
@@ -153,6 +153,20 @@ freeCmdline(struct cmdlineInfo const cmdline) {
 
 
 static void
+checkSize(int cols, int rows){
+
+    if (cols > 255)
+        pm_error("This program cannot handle files with more than 255 "
+                 "columns");
+    if (rows > 255)
+        pm_error("This program cannot handle files with more than 255 "
+                 "rows");
+}
+
+
+
+
+static void
 convertToHexNol(bit **       const image,
                 unsigned int const cols,
                 unsigned int const rows,
@@ -455,6 +469,7 @@ main(int    argc,
     ifP = pm_openr(cmdline.inputFileName);
     bits = pbm_readpbm(ifP, &cols, &rows);
     pm_close(ifP);
+    checkSize(cols, rows);
 
     switch (cmdline.outputFormat) {
     case FMT_HEX_NGG:
diff --git a/doc/HISTORY b/doc/HISTORY
index 000c4211..af60e985 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,25 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+08.09.03 BJH  Release 10.39.05
+
+              pamstack: accept Standard Input properly.
+
+              libnetpbm: pbm_readppminit: read PBM as maxval of 255, not 1.
+
+              libnetpbm: Reject empty TUPLTYPE header.
+
+              libnetpbm: Fix uninitialized variable in pnm_allocpamrown().
+
+              pbmtonokia: fail if input is > 255 x 255.  Thanks Paul Bolle
+              <pebolle@tiscali.nl>.
+
+              pnmtopalm: fix typo in error message.  Thanks Paul Bolle
+              <pebolle@tiscali.nl>.
+
+              Build: don't build pstopnm on system without unix process
+              management.
+
 07.08.18 BJH  Release 10.39.04
 
               Build: put -l's after .o's in test links.
@@ -152,7 +171,7 @@ CHANGE HISTORY
               libnetpbm: fix crash with PBM images < 8 columns on MMX/SSE
               machine.
 
-              pamtogif: fail properly if image to wide or high for GIF.
+              pamtogif: fail properly if image too wide or high for GIF.
 
               ppmdraw: fix crash with use of freed storage.  Thanks
               John Walker <kelvin@fourmilab.ch>.
diff --git a/lib/libpam.c b/lib/libpam.c
index 362c1159..db8ff205 100644
--- a/lib/libpam.c
+++ b/lib/libpam.c
@@ -549,16 +549,20 @@ process_header_line(char                const buffer[],
             pamP->maxval = atoi(value);
             headerSeenP->maxval = TRUE;
         } else if (strcmp(label, "TUPLTYPE") == 0) {
-            int len = strlen(pamP->tuple_type);
-            if (len + strlen(value) + 1 > sizeof(pamP->tuple_type)-1)
-                pm_error("TUPLTYPE value too long in PAM header");
-            if (len == 0)
-                strcpy(pamP->tuple_type, value);
+            if (strlen(value) == 0)
+                pm_error("TUPLTYPE header does not have any tuple type text");
             else {
-                strcat(pamP->tuple_type, "\n");
-                strcat(pamP->tuple_type, value);
+                size_t const oldLen = strlen(pamP->tuple_type);
+                if (oldLen + strlen(value) + 1 > sizeof(pamP->tuple_type)-1)
+                    pm_error("TUPLTYPE value too long in PAM header");
+                if (oldLen == 0)
+                    strcpy(pamP->tuple_type, value);
+                else {
+                    strcat(pamP->tuple_type, " ");
+                    strcat(pamP->tuple_type, value);
+                }
+                pamP->tuple_type[sizeof(pamP->tuple_type)-1] = '\0';
             }
-            pamP->tuple_type[sizeof(pamP->tuple_type)-1] = '\0';
         } else 
             pm_error("Unrecognized header line: '%s'.  "
                      "Possible missing ENDHDR line?", label);
@@ -708,12 +712,11 @@ pnm_readpaminitrestaspnm(FILE * const fileP,
     case 1:
         *formatP = RPGM_FORMAT;
         break;
-    default: {
+    default:
         pm_error("Cannot treat PAM image as PPM or PGM, "
                  "because its depth (%u) "
                  "is not 1 or 3.", pam.depth);
     }
-    }
 
     *colsP   = pam.width;
     *rowsP   = pam.height;
diff --git a/lib/libppm1.c b/lib/libppm1.c
index a7ea78cf..425f2ab1 100644
--- a/lib/libppm1.c
+++ b/lib/libppm1.c
@@ -135,7 +135,8 @@ ppm_readppminit(FILE *   const fileP,
 
     case PBM_TYPE:
         *formatP = realFormat;
-        *maxvalP = 1;
+        /* See comment in pgm_readpgminit() about this maxval */
+        *maxvalP = PPM_MAXMAXVAL;
         pbm_readpbminitrest(fileP, colsP, rowsP);
         break;
 
diff --git a/other/pamstack.c b/other/pamstack.c
index 4f8d9945..d9691f74 100644
--- a/other/pamstack.c
+++ b/other/pamstack.c
@@ -15,6 +15,7 @@
 #include <string.h>
 
 #include "mallocvar.h"
+#include "nstring.h"
 #include "shhopt.h"
 #include "pam.h"
 
@@ -72,16 +73,23 @@ parseCommandLine(int argc, char ** argv,
 
     cmdlineP->nInput = 0;  /* initial value */
     { 
-        int argn;
-        for (argn = 1; argn < argc; argn++) {
+        unsigned int argn;
+        bool stdinUsed;
+        for (argn = 1, stdinUsed = false; argn < argc; ++argn) {
             if (cmdlineP->nInput >= MAX_INPUTS) 
-                pm_error("You may not specify more than %d input images.",
+                pm_error("You may not specify more than %u input images.",
                          MAX_INPUTS);
             cmdlineP->inputFileName[cmdlineP->nInput++] = argv[argn];
+            if (streq(argv[argn], "-")) {
+                if (stdinUsed)
+                    pm_error("You cannot specify Standard Input ('-') "
+                             "for more than one input file");
+                stdinUsed = true;
+            }
         }
     }
     if (cmdlineP->nInput < 1)
-        pm_error("You must specify at least one input PAM image.");
+        cmdlineP->inputFileName[cmdlineP->nInput++] = "-";
 }