about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-03-26 02:06:57 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-03-26 02:06:57 +0000
commit99d760c5aa3dac7cbde58d10c7b0a9213602d7ad (patch)
tree57764fe3668a003963f96da6352ec82f2b442888
parentb7cd16e68be723fdb25725de1d59763fc7272fae (diff)
downloadnetpbm-mirror-99d760c5aa3dac7cbde58d10c7b0a9213602d7ad.tar.gz
netpbm-mirror-99d760c5aa3dac7cbde58d10c7b0a9213602d7ad.tar.xz
netpbm-mirror-99d760c5aa3dac7cbde58d10c7b0a9213602d7ad.zip
Release 10.86.11
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3775 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/pbmtopgm.c8
-rw-r--r--doc/HISTORY13
-rw-r--r--editor/pnmshear.c8
-rw-r--r--version.mk2
4 files changed, 28 insertions, 3 deletions
diff --git a/converter/other/pbmtopgm.c b/converter/other/pbmtopgm.c
index 69b20fb2..c35e1cbe 100644
--- a/converter/other/pbmtopgm.c
+++ b/converter/other/pbmtopgm.c
@@ -3,6 +3,7 @@
  */
 
 #include <stdio.h>
+#include <limits.h>
 
 #include "pm_c_util.h"
 #include "pgm.h"
@@ -29,8 +30,13 @@ main(int argc, char *argv[]) {
     height = atoi(argv[2]);
     if (width < 1 || height < 1)
         pm_error("width and height must be > 0");
+    if (width > INT_MAX / height)
+        /* prevent overflow of "value" below */
+        pm_error("sample area (%u columns %u rows) too large",
+                 width, height);
+
     left=width/2; right=width-left;
-    up=width/2; down=height-up;
+    up=height/2; down=height-up;
 
     if (argc == 4)
         ifd = pm_openr(argv[3]);
diff --git a/doc/HISTORY b/doc/HISTORY
index 8955dccd..01288125 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,19 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+20.03.26 BJH  Release 10.86.11
+
+              pbmtopgm: Fix incorrect output when convolution area is not
+              square.  Always broken.  pbmtopgm was in primordial Netpbm,
+              ca 1991.
+
+              pbmtopgm: Fix crash when convolution matrix too large for word
+              size.  Always broken.  pbmtopgm was in primordial Netpbm, ca
+              1991.
+
+              pnmshear: Fix arithmetic overflow with shear angle near +/- 90
+              degrees.
+
 20.03.15 BJH  Release 10.86.10
 
               pamdice: Fix crash when -width or -height is zero.
diff --git a/editor/pnmshear.c b/editor/pnmshear.c
index 1c330bb7..c705c261 100644
--- a/editor/pnmshear.c
+++ b/editor/pnmshear.c
@@ -217,6 +217,7 @@ main(int argc, const char * argv[]) {
     int row;
     xelval maxval, newmaxval;
     double shearfac;
+    double newcolsD;
 
     struct CmdlineInfo cmdline;
 
@@ -242,7 +243,12 @@ main(int argc, const char * argv[]) {
 
     shearfac = fabs(tan(cmdline.angle));
 
-    newcols = rows * shearfac + cols + 0.999999;
+    newcolsD = (double) rows * shearfac + cols + 0.999999;
+    if (newcolsD > INT_MAX-2)
+        pm_error("angle is too close to +/-90 degrees; "
+                 "output image too wide for computation");
+    else
+        newcols = (int) newcolsD;
 
     pnm_writepnminit(stdout, newcols, rows, newmaxval, newformat, 0);
     newxelrow = pnm_allocrow(newcols);
diff --git a/version.mk b/version.mk
index 4e02899e..272904e5 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 86
-NETPBM_POINT_RELEASE = 10
+NETPBM_POINT_RELEASE = 11