From b69ed32eefbedb589d1b521d884bd511e2db3fdf Mon Sep 17 00:00:00 2001 From: giraffedata Date: Mon, 7 Jan 2019 16:22:51 +0000 Subject: Release 10.85.01 git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3495 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- doc/HISTORY | 12 ++++++++++++ editor/pamstretch.c | 16 +++++++++++++--- editor/ppmbrighten.c | 25 ++++++++++++++++--------- editor/ppmdraw.c | 2 +- version.mk | 2 +- 5 files changed, 43 insertions(+), 14 deletions(-) diff --git a/doc/HISTORY b/doc/HISTORY index f0dc1084..f95fc8c0 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,18 @@ Netpbm. CHANGE HISTORY -------------- +19.01.07 BJH Release 10.85.01 + + 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.29 BJH Release 10.85.00 pnmpaste: Add -nand, -nor, and -nxor. 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 6ee6897b..96bca478 100644 --- a/editor/ppmbrighten.c +++ b/editor/ppmbrighten.c @@ -292,12 +292,17 @@ main(int argc, const 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, const 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 c76489c9..3453a7e1 100644 --- a/editor/ppmdraw.c +++ b/editor/ppmdraw.c @@ -570,7 +570,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 219ac63e..24da05a1 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 85 -NETPBM_POINT_RELEASE = 0 +NETPBM_POINT_RELEASE = 1 -- cgit 1.4.1