From cd71bbe55d95913bd4a4d38ea83ce1cf8d8ce35a Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 28 Jun 2017 22:16:29 +0000 Subject: Release 10.73.12 git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3009 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/bmptopnm.c | 10 ++++++++-- doc/HISTORY | 9 +++++++++ generator/pamgauss.c | 3 ++- version.mk | 2 +- 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 -- cgit 1.4.1