diff options
-rw-r--r-- | converter/other/pnmtops.c | 14 | ||||
-rw-r--r-- | doc/HISTORY | 5 |
2 files changed, 12 insertions, 7 deletions
diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c index 2d513853..bcca8bfb 100644 --- a/converter/other/pnmtops.c +++ b/converter/other/pnmtops.c @@ -149,11 +149,13 @@ validateCompDimension(unsigned int const value, the actual computations don't have to be complicated with arithmetic overflow checks, so they're easier to read. -----------------------------------------------------------------------------*/ - unsigned int const maxWidthHeight = INT_MAX - 2; - unsigned int const maxScaleFactor = maxWidthHeight / value; + if (value > 0) { + unsigned int const maxWidthHeight = INT_MAX - 2; + unsigned int const maxScaleFactor = maxWidthHeight / value; - if (scaleFactor > maxScaleFactor) - pm_error("%s is too large for compuations: %u", vname, value); + if (scaleFactor > maxScaleFactor) + pm_error("%s is too large for compuations: %u", vname, value); + } } @@ -225,10 +227,10 @@ parseCommandLine(int argc, const char ** argv, cmdlineP->scale = 1.0; if (!widthSpec) - cmdlineP->width = 8.5; + width = 8.5; if (!heightSpec) - cmdlineP->height = 11.0; + height = 11.0; if (dpiSpec) parseDpi(dpiOpt, &cmdlineP->dpiX, &cmdlineP->dpiY); diff --git a/doc/HISTORY b/doc/HISTORY index 042a5bac..cf65ec8c 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -11,7 +11,10 @@ not yet BJH Release 10.55.00 supply a Standard Output accepter. Broken in 10.40.00. ppmtopbm: fix bug: crash ("internal error") on image without - palette (e.g. black and white). Broken in 10.54. + palette (e.g. black and white). Introduced in 10.54. + + pnmtops: fix floating point exception or bogus width/height + too large error. Introduced in 10.53. 11.03.30 BJH Release 10.54.00 |