about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-07 15:41:07 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-07 15:41:07 +0000
commitf9aeba86b7572e433c798f9cb2210e014077d1b9 (patch)
tree4ed5f2dbb079dac28d64268db59bb4875c40e9b0
parente8bfe183b5e504f0f30691484e9d73ea42113363 (diff)
downloadnetpbm-mirror-f9aeba86b7572e433c798f9cb2210e014077d1b9.tar.gz
netpbm-mirror-f9aeba86b7572e433c798f9cb2210e014077d1b9.tar.xz
netpbm-mirror-f9aeba86b7572e433c798f9cb2210e014077d1b9.zip
Release 10.78.05
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2989 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/bmptopnm.c11
-rw-r--r--doc/HISTORY9
-rw-r--r--generator/pamgauss.c3
-rw-r--r--version.mk2
4 files changed, 21 insertions, 4 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index 54868364..49e730fd 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -384,10 +384,17 @@ readWindowsBasic40ByteInfoHeader(FILE *                 const ifP,
 -----------------------------------------------------------------------------*/
     int colorsused;        /* ColorsUsed value from header */
     unsigned short planesField, bitCountField;
+    int32_t colsField;
 
-    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 fb1ffbc5..bf4082a6 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,15 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+17.07.07 BJH  Release 10.78.05
+
+              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.78.04
 
               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 15e6a2e5..dc1caea0 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 78
-NETPBM_POINT_RELEASE = 4
+NETPBM_POINT_RELEASE = 5