diff options
-rw-r--r-- | converter/other/bmptopnm.c | 11 | ||||
-rw-r--r-- | doc/HISTORY | 9 | ||||
-rw-r--r-- | generator/pamgauss.c | 3 | ||||
-rw-r--r-- | version.mk | 2 |
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 |