about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile.version2
-rw-r--r--converter/other/bmptopnm.c14
-rw-r--r--doc/HISTORY4
-rw-r--r--editor/pamthreshold.c10
4 files changed, 14 insertions, 16 deletions
diff --git a/Makefile.version b/Makefile.version
index 2ae77b21..b72e90c0 100644
--- a/Makefile.version
+++ b/Makefile.version
@@ -1,4 +1,4 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 40
-NETPBM_POINT_RELEASE = 00
+NETPBM_POINT_RELEASE = 01
 
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index 3ba1d77c..4d29e4d3 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -651,11 +651,15 @@ extractBitFields(unsigned int       const rasterval,
     unsigned int const abits = 
         (rasterval >> pixelformat.trn.shift) & pixelformat.trn.mask;
     
-    *rP = (unsigned int) rbits * maxval / pixelformat.red.mask;
-    *gP = (unsigned int) gbits * maxval / pixelformat.blu.mask;
-    *bP = (unsigned int) bbits * maxval / pixelformat.grn.mask;
-    *aP = (unsigned int) abits * maxval / pixelformat.trn.mask;
-}        
+    *rP = pixelformat.red.mask ?
+              (unsigned int) rbits * maxval / pixelformat.red.mask : 0;
+    *gP = pixelformat.grn.mask ?
+              (unsigned int) gbits * maxval / pixelformat.grn.mask : 0;
+    *bP = pixelformat.blu.mask ?
+              (unsigned int) bbits * maxval / pixelformat.blu.mask : 0;
+    *aP = pixelformat.trn.mask ?
+              (unsigned int) abits * maxval / pixelformat.trn.mask : 0;
+}
 
 
 
diff --git a/doc/HISTORY b/doc/HISTORY
index 489b16b3..65d96670 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,10 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+not yet  BJH  Release 10.40.01
+
+              bmptopnm: fix crash with 16 bit images.
+
 07.09.26 BJH  Release 10.40.00
 
               pamfunc: Add -andmask, -ormask, -xormask, -not,
diff --git a/editor/pamthreshold.c b/editor/pamthreshold.c
index f45649bf..e6eed864 100644
--- a/editor/pamthreshold.c
+++ b/editor/pamthreshold.c
@@ -84,16 +84,6 @@ addToRange(struct range * const rangeP,
 
 
 
-static void
-assertRangeValid(struct range const range) {
-
-    assert(betweenZeroAndOne(range.min));
-    assert(betweenZeroAndOne(range.max));
-    assert(range.max >= range.min);
-}
-
-
-
 static float
 spread(struct range const range) {