From ed784035a8c397995f66eac86c8072cb7546643b Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 10 Feb 2019 07:37:59 +0000 Subject: Release 10.73.25 git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3546 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pnmtopng.c | 17 +++++++++++------ doc/HISTORY | 15 +++++++++++++++ editor/pamstretch.c | 16 +++++++++++++--- editor/ppmbrighten.c | 25 ++++++++++++++++--------- editor/ppmdraw.c | 2 +- version.mk | 2 +- 6 files changed, 57 insertions(+), 20 deletions(-) diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c index ac171453..ce723d40 100644 --- a/converter/other/pnmtopng.c +++ b/converter/other/pnmtopng.c @@ -2436,7 +2436,11 @@ doIhdrChunk(struct pngx * const pngxP, unsigned int const depth, bool const colorMapped, bool const colorPng, - bool const alpha) { + bool const alpha, + bool const interlace) { + + int const interlaceMethod = + interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE; int colorType; @@ -2450,7 +2454,8 @@ doIhdrChunk(struct pngx * const pngxP, if (alpha && colorType != PNG_COLOR_TYPE_PALETTE) colorType |= PNG_COLOR_MASK_ALPHA; - pngx_setIhdr(pngxP, width, height, depth, colorType, 0, 0, 0); + pngx_setIhdr(pngxP, width, height, depth, colorType, + interlaceMethod, 0, 0); } @@ -2820,10 +2825,8 @@ convertpnm(struct cmdlineInfo const cmdline, pm_error ("setjmp returns error condition (2)"); } - doIhdrChunk(pngxP, cols, rows, depth, colorMapped, colorPng, alpha); - - if (cmdline.interlace) - pngx_setInterlaceHandling(pngxP); + doIhdrChunk(pngxP, cols, rows, depth, colorMapped, colorPng, alpha, + cmdline.interlace); doGamaChunk(cmdline, pngxP); @@ -2875,6 +2878,8 @@ convertpnm(struct cmdlineInfo const cmdline, /* let libpng take care of, e.g., bit-depth conversions */ pngx_setPacking(pngxP); + pngx_setInterlaceHandling(pngxP); + writeRaster(pngxP, ifP, rasterPos, cols, rows, maxval, format, pngMaxval, depth, alpha, alpha_mask, cht, caht); diff --git a/doc/HISTORY b/doc/HISTORY index f06128f9..bdcf87b6 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,21 @@ Netpbm. CHANGE HISTORY -------------- +18.02.09 BJH Release 10.73.25 + + pnmtopng: fix bug: -interlace ignored. Broken in 10.55 + (June 2011). + + pamstretch: Reject very large scale factors instead of producing + incorrect output. + + ppmbrighten: Fix crash with -normalize when there is only one + intensity in the image. Always broken - Ppmbrighten was new in + the first Netpbm release in 1991. + + ppmdraw: Fix bug: 'setlinetype nodiag' says invalid type. + Always broken. (Ppmdraw was new in Netpbm 10.29 (August 2005)). + 18.12.17 BJH Release 10.73.24 bmptopnm: Fix wrong output for non-colormapped OS2 BMP. Broken diff --git a/editor/pamstretch.c b/editor/pamstretch.c index 8980dd0b..04883c35 100644 --- a/editor/pamstretch.c +++ b/editor/pamstretch.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "pm_c_util.h" #include "pam.h" @@ -389,9 +390,18 @@ main(int argc,char *argv[]) { } { unsigned int const dropped = cmdline.edge_mode == EDGE_DROP ? 1 : 0; - - outpam.width = (inpam.width - dropped) * cmdline.xscale; - outpam.height = (inpam.height - dropped) * cmdline.yscale; + double const width = (inpam.width - dropped) * cmdline.xscale; + double const height = (inpam.height - dropped) * cmdline.yscale; + + if (width > INT_MAX - 2) + pm_error("output image width (%f) too large for computations", + width); + if (height > INT_MAX - 2) + pm_error("output image height (%f) too large for computation", + height); + + outpam.width = width; + outpam.height = height; pnm_writepaminit(&outpam); } diff --git a/editor/ppmbrighten.c b/editor/ppmbrighten.c index a7aba2e7..a3e9a270 100644 --- a/editor/ppmbrighten.c +++ b/editor/ppmbrighten.c @@ -292,12 +292,17 @@ main(int argc, char * argv[]) { pm_tell2(ifP, &rasterPos, sizeof(rasterPos)); getMinMax(ifP, cols, rows, maxval, format, &minValue, &maxValue); pm_seek2(ifP, &rasterPos, sizeof(rasterPos)); - pm_message("Minimum value %u%% of full intensity " - "being remapped to zero.", - (minValue*100+MULTI/2)/MULTI); - pm_message("Maximum value %u%% of full intensity " - "being remapped to full.", - (maxValue*100+MULTI/2)/MULTI); + if (maxValue > minValue) { + pm_message("Minimum value %u%% of full intensity " + "being remapped to zero.", + (minValue*100+MULTI/2)/MULTI); + pm_message("Maximum value %u%% of full intensity " + "being remapped to full.", + (maxValue*100+MULTI/2)/MULTI); + } else + pm_message("Sole intensity value %u%% of full intensity " + "not being remapped", + (minValue*100+MULTI/2)/MULTI); } pixelrow = ppm_allocrow(cols); @@ -313,9 +318,11 @@ main(int argc, char * argv[]) { RGBtoHSV(pixelrow[col], maxval, &H, &S, &V); if (cmdline.normalize) { - V -= minValue; - V = (V * MULTI) / - (MULTI - (minValue+MULTI-maxValue)); + if (maxValue > minValue) { + V -= minValue; + V = (V * MULTI) / + (MULTI - (minValue+MULTI-maxValue)); + } } S = MIN(MULTI, (unsigned int) (S * cmdline.saturation + 0.5)); diff --git a/editor/ppmdraw.c b/editor/ppmdraw.c index 63d781ec..bd569e03 100644 --- a/editor/ppmdraw.c +++ b/editor/ppmdraw.c @@ -569,7 +569,7 @@ parseDrawCommand(struct tokenSet const commandTokens, const char * const typeArg = commandTokens.token[1]; if (streq(typeArg, "normal")) drawCommandP->u.setlinetypeArg.type = PPMD_LINETYPE_NORMAL; - else if (streq(typeArg, "normal")) + else if (streq(typeArg, "nodiag")) drawCommandP->u.setlinetypeArg.type = PPMD_LINETYPE_NODIAGS; else diff --git a/version.mk b/version.mk index 4c66bc59..f1216717 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 73 -NETPBM_POINT_RELEASE = 24 +NETPBM_POINT_RELEASE = 25 -- cgit 1.4.1