about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-03-30 15:20:34 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-03-30 15:20:34 +0000
commitaba8428cb76de567abd4ffda1c3280f970d0692c (patch)
tree1ed6ebbfa3fde2201781ab357df8c7b5720c2db5
parent6623940f7e7584a9e1c42db14f4d49adedff7e52 (diff)
downloadnetpbm-mirror-aba8428cb76de567abd4ffda1c3280f970d0692c.tar.gz
netpbm-mirror-aba8428cb76de567abd4ffda1c3280f970d0692c.tar.xz
netpbm-mirror-aba8428cb76de567abd4ffda1c3280f970d0692c.zip
Release 10.47.72
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3589 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/bmptopnm.c7
-rw-r--r--doc/HISTORY15
-rw-r--r--editor/pamstretch.c16
-rw-r--r--editor/ppmbrighten.c25
-rw-r--r--editor/ppmdraw.c2
-rw-r--r--version.mk2
6 files changed, 53 insertions, 14 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index dfd175aa..fb89433c 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -231,6 +231,11 @@ GetCieXyzTriple(FILE * const fp) {
 
 
 
+static struct pixelformat
+defaultPixelformat(unsigned int const bitCount);
+
+
+
 static void
 readOffBytes(FILE * const fp, unsigned int const nbytes) {
 /*----------------------------------------------------------------------------
@@ -322,6 +327,8 @@ readOs2InfoHeader(FILE *                 const ifP,
         pm_error("Unrecognized bits per pixel in OS/2 BMP file header: %d",
                  headerP->cBitCount);
                  
+    headerP->pixelformat = defaultPixelformat(headerP->cBitCount);
+
     headerP->compression = COMP_RGB;
     
     pm_message("OS/2 BMP, %dx%dx%d",
diff --git a/doc/HISTORY b/doc/HISTORY
index de601759..c91f6aca 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,21 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+19.03.30 BJH  Release 10.47.72
+
+              pamstretch: Reject very large scale factors instead of producing
+              incorrect output.
+
+              ppmbrighten: Fix crash with -normalize when there is only one
+              intensity in the image.  Always broken - Ppmbrighten was new in
+              the first Netpbm release in 1991.
+
+              ppmdraw: Fix bug: 'setlinetype nodiag' says invalid type.
+              Always broken.  (Ppmdraw was new in Netpbm 10.29 (August 2005)).
+
+              bmptopnm: Fix wrong output for non-colormapped OS2 BMP.  Broken
+              in Netpbm 10.18 (September 2003).
+
 18.12.05 BJH  Release 10.47.71
 
               picttoppm: accept rectangle specifications in input that have
diff --git a/editor/pamstretch.c b/editor/pamstretch.c
index 87c105f9..cfbddcb4 100644
--- a/editor/pamstretch.c
+++ b/editor/pamstretch.c
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <limits.h>
 
 #include "pm_c_util.h"
 #include "pam.h"
@@ -389,9 +390,18 @@ main(int argc,char *argv[]) {
     }
     {
         unsigned int const dropped = cmdline.edge_mode == EDGE_DROP ? 1 : 0;
-
-        outpam.width = (inpam.width - dropped) * cmdline.xscale;
-        outpam.height = (inpam.height - dropped) * cmdline.yscale;
+        double const width  = (inpam.width  - dropped) * cmdline.xscale;
+        double const height = (inpam.height - dropped) * cmdline.yscale;
+
+        if (width > INT_MAX - 2)
+            pm_error("output image width (%f) too large for computations",
+                     width);
+        if (height > INT_MAX - 2)
+            pm_error("output image height (%f) too large for computation",
+                     height);
+ 
+        outpam.width  = width;
+        outpam.height = height;
 
         pnm_writepaminit(&outpam);
     }
diff --git a/editor/ppmbrighten.c b/editor/ppmbrighten.c
index 49f05c3a..0a4b1140 100644
--- a/editor/ppmbrighten.c
+++ b/editor/ppmbrighten.c
@@ -292,12 +292,17 @@ main(int argc, char * argv[]) {
         pm_tell2(ifP, &rasterPos, sizeof(rasterPos));
         getMinMax(ifP, cols, rows, maxval, format, &minValue, &maxValue);
         pm_seek2(ifP, &rasterPos, sizeof(rasterPos));
-        pm_message("Minimum value %u%% of full intensity "
-                   "being remapped to zero.",
-                   (minValue*100+MULTI/2)/MULTI);
-        pm_message("Maximum value %u%% of full intensity "
-                   "being remapped to full.",
-                   (maxValue*100+MULTI/2)/MULTI);
+        if (maxValue > minValue) {
+            pm_message("Minimum value %u%% of full intensity "
+                       "being remapped to zero.",
+                       (minValue*100+MULTI/2)/MULTI);
+            pm_message("Maximum value %u%% of full intensity "
+                       "being remapped to full.",
+                       (maxValue*100+MULTI/2)/MULTI);
+        } else
+            pm_message("Sole intensity value %u%% of full intensity "
+                       "not being remapped",
+                       (minValue*100+MULTI/2)/MULTI);
     }
 
     pixelrow = ppm_allocrow(cols);
@@ -313,9 +318,11 @@ main(int argc, char * argv[]) {
             RGBtoHSV(pixelrow[col], maxval, &H, &S, &V);
             
             if (cmdline.normalize) {
-                V -= minValue;
-                V = (V * MULTI) /
-                    (MULTI - (minValue+MULTI-maxValue));
+                if (maxValue > minValue) {
+                    V -= minValue;
+                    V = (V * MULTI) /
+                        (MULTI - (minValue+MULTI-maxValue));
+                }
             }
 
             S = MIN(MULTI, (unsigned int) (S * cmdline.saturation + 0.5));
diff --git a/editor/ppmdraw.c b/editor/ppmdraw.c
index 3bd271a6..70ae842f 100644
--- a/editor/ppmdraw.c
+++ b/editor/ppmdraw.c
@@ -533,7 +533,7 @@ parseDrawCommand(struct tokenSet             const commandTokens,
                 const char * const typeArg = commandTokens.token[1];
                 if (streq(typeArg, "normal"))
                     drawCommandP->u.setlinetypeArg.type = PPMD_LINETYPE_NORMAL;
-                else if (streq(typeArg, "normal"))
+                else if (streq(typeArg, "nodiag"))
                     drawCommandP->u.setlinetypeArg.type = 
                         PPMD_LINETYPE_NODIAGS;
                 else
diff --git a/version.mk b/version.mk
index 6688e866..f8ccf3d2 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 47
-NETPBM_POINT_RELEASE = 71
+NETPBM_POINT_RELEASE = 72