about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile2
-rw-r--r--Makefile.version2
-rw-r--r--analyzer/pgmtexture.c2
-rw-r--r--doc/HISTORY16
-rw-r--r--editor/pamdeinterlace.c8
-rw-r--r--editor/ppmrelief.c18
6 files changed, 39 insertions, 9 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 5aa25ca9..a0ce450c 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -220,6 +220,8 @@ init_package:
 	$(INSTALL) -c -m 664 $(SRCDIR)/buildtools/README.pkg $(PKGDIR)/README
 	$(INSTALL) -c -m 664 $(SRCDIR)/buildtools/config_template \
 	  $(PKGDIR)/config_template
+	$(INSTALL) -c -m 664 $(SRCDIR)/buildtools/pkgconfig_template \
+	  $(PKGDIR)/pkgconfig_template
 
 advise_installnetpbm:
 	@echo
diff --git a/Makefile.version b/Makefile.version
index 451fc509..a502a9d4 100644
--- a/Makefile.version
+++ b/Makefile.version
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 35
-NETPBM_POINT_RELEASE = 91
+NETPBM_POINT_RELEASE = 92
diff --git a/analyzer/pgmtexture.c b/analyzer/pgmtexture.c
index 6a9f5a4f..e9a03af5 100644
--- a/analyzer/pgmtexture.c
+++ b/analyzer/pgmtexture.c
@@ -814,7 +814,7 @@ int
 main (int argc, char *argv[]) {
     FILE *ifp;
     register gray **grays;
-    int tone[PGM_MAXMAXVAL], R0, R45, R90, angle, d = 1, x, y;
+    int tone[PGM_MAXMAXVAL+1], R0, R45, R90, angle, d = 1, x, y;
     int argn, rows, cols, row, col;
     int itone, jtone, tones;
     float **P_matrix0, **P_matrix45, **P_matrix90, **P_matrix135;
diff --git a/doc/HISTORY b/doc/HISTORY
index 8dd926a1..38593cb4 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,22 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+14.03.29 BJH  Release 10.35.92
+
+              ppmrelief: fix out-of-bound values in output.  Always broken.
+              Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+
+              ppmrelief: fix crash when input image is too small.  Always
+              broken.  Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+
+              pgmtexture: fix buffer overflow.  Always broken.  (Program
+              was added in primordial Netpbm in 1991).
+
+              pamdeinterlace: fix incorrect output with -takeodd and image has
+              only one row.  Always broken (pamdeinterlace was introduced in
+              Netpbm 9.21 (January 2001)).  Thanks Prophet of the Way
+              <afu@wta.att.ne.jp>.
+
 13.12.24 BJH  Release 10.35.91
 
               pbmtoepsi: fix handling of all-white image.  Always broken.
diff --git a/editor/pamdeinterlace.c b/editor/pamdeinterlace.c
index 9ed1d8eb..db893708 100644
--- a/editor/pamdeinterlace.c
+++ b/editor/pamdeinterlace.c
@@ -31,7 +31,7 @@ parseCommandLine(int argc, char ** argv,
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
     optStruct3 opt;  /* set by OPTENT3 */
-    optEntry *option_def;
+    optEntry * option_def;
     unsigned int option_def_index;
 
     unsigned int takeeven, takeodd;
@@ -49,6 +49,8 @@ parseCommandLine(int argc, char ** argv,
     optParseOptions3(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
+    free(option_def);
+
     if (takeeven && takeodd)
         pm_error("You cannot specify both -takeeven and -takeodd options.");
 
@@ -89,6 +91,10 @@ main(int argc, char *argv[]) {
     
     pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));
 
+    if (inpam.height < 2 && cmdline.rowsToTake == ODD)
+        pm_error("You requested to take the odd rows, but there aren't "
+                 "any odd rows in the image - it has only one row - Row 0");
+
     tuplerow = pnm_allocpamrow(&inpam);
 
     outpam = inpam;    /* Initial value -- most fields should be same */
diff --git a/editor/ppmrelief.c b/editor/ppmrelief.c
index 5e0669c3..1c408aec 100644
--- a/editor/ppmrelief.c
+++ b/editor/ppmrelief.c
@@ -11,6 +11,7 @@
 */
 
 #include <stdio.h>
+#include "pm_c_util.h"
 #include "ppm.h"
 
 int
@@ -38,6 +39,11 @@ main(int argc, char * argv[]) {
         pm_usage( usage );
     
     ppm_readppminit( ifp, &cols, &rows, &maxval, &format );
+
+    if (cols < 3 || rows < 3 )
+        pm_error("Input image too small: %u x %u.  Must be at least 3x3",
+                  cols, rows);
+
     mv2 = maxval / 2;
 
     /* Allocate space for 3 input rows, plus an output row. */
@@ -67,12 +73,12 @@ main(int argc, char * argv[]) {
         ppm_readppmrow( ifp, inputbuf[rowa], cols, maxval, format );
         
         for ( col = 0; col < cols - 2; ++col ) {
-            r = PPM_GETR( inputbuf[rowa][col] ) +
-                ( mv2 - PPM_GETR( inputbuf[rowb][col + 2] ) );
-            g = PPM_GETG( inputbuf[rowa][col] ) +
-                ( mv2 - PPM_GETG( inputbuf[rowb][col + 2] ) );
-            b = PPM_GETB( inputbuf[rowa][col] ) +
-                ( mv2 - PPM_GETB( inputbuf[rowb][col + 2] ) );
+            r = MAX(0, MIN(maxval, PPM_GETR( inputbuf[rowa][col] ) +
+                           ( mv2 - PPM_GETR( inputbuf[rowb][col + 2] ) )));
+            g = MAX(0, MIN(maxval, PPM_GETG( inputbuf[rowa][col] ) +
+                           ( mv2 - PPM_GETG( inputbuf[rowb][col + 2] ) )));
+            b = MAX(0, MIN(maxval, PPM_GETB( inputbuf[rowa][col] ) +
+                           ( mv2 - PPM_GETB( inputbuf[rowb][col + 2] ) )));
             PPM_ASSIGN( outputrow[col + 1], r, g, b );
         }
         ppm_writeppmrow( stdout, outputrow, cols, maxval, 0 );