about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-28 22:16:29 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-28 22:16:29 +0000
commitcd71bbe55d95913bd4a4d38ea83ce1cf8d8ce35a (patch)
treeb8d059e5cf675305c757f0a636db5343be33dfec
parent3b7ef037562cdd48e79ae588c69a6713da6e7b16 (diff)
downloadnetpbm-mirror-cd71bbe55d95913bd4a4d38ea83ce1cf8d8ce35a.tar.gz
netpbm-mirror-cd71bbe55d95913bd4a4d38ea83ce1cf8d8ce35a.tar.xz
netpbm-mirror-cd71bbe55d95913bd4a4d38ea83ce1cf8d8ce35a.zip
Release 10.73.12
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3009 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/bmptopnm.c10
-rw-r--r--doc/HISTORY9
-rw-r--r--generator/pamgauss.c3
-rw-r--r--version.mk2
4 files changed, 20 insertions, 4 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index bb49f4a4..05749c27 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -369,12 +369,18 @@ readWindowsBasic40ByteInfoHeader(FILE *                 const ifP,
     int colorsimportant;   /* ColorsImportant value from header */
     int colorsused;        /* ColorsUsed value from header */
     unsigned short planesField, bitCountField;
+    int32_t colsField;
 
     headerP->class = C_WIN;
 
-    headerP->cols = GetLong(ifP);
-    if (headerP->cols == 0)
+    pm_readlittlelong2(ifP, &colsField);
+
+    if (colsField == 0)
         pm_error("Invalid BMP file: says width is zero");
+    else if (colsField < 0)
+        pm_error("Invalid BMP file: says width is negative (%d)", colsField);
+    else
+        headerP->cols = (unsigned int)colsField;
     {
         long const cy = GetLong(ifP);
 
diff --git a/doc/HISTORY b/doc/HISTORY
index 5b6c78b8..7aec1771 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,15 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+17.06.28 BJH  Release 10.73.12
+
+              pamgauss: Fix skewed output with even dimension.  Always broken
+              (Pamgauss was added in Netpbm 10.23 (July 2004).
+
+              bmptopnm: fix crash when input is a Windows BMP with negative
+              number for width.  Always broken.  (bmptopnm was new, as
+              bmptoppm, in original Netpbm, 1992).
+
 17.05.27 BJH  Release 10.73.11
 
               pamcrater: fix incorrect output with non-square image.
diff --git a/generator/pamgauss.c b/generator/pamgauss.c
index 82c340fa..2dd6a726 100644
--- a/generator/pamgauss.c
+++ b/generator/pamgauss.c
@@ -111,7 +111,8 @@ distFromCenter(struct pam * const pamP,
                int          const col,
                int          const row) {
 
-    return sqrt(SQR(col - pamP->width/2) + SQR(row - pamP->height/2));
+    return sqrt(SQR(0.5 + col - (double)pamP->width/2) +
+                SQR(0.5 + row - (double)pamP->height/2));
 }
 
 
diff --git a/version.mk b/version.mk
index 8c6be845..74120acb 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 73
-NETPBM_POINT_RELEASE = 11
+NETPBM_POINT_RELEASE = 12