diff options
-rw-r--r-- | editor/pnmscalefixed.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c index 05d56578..1a89a2e5 100644 --- a/editor/pnmscalefixed.c +++ b/editor/pnmscalefixed.c @@ -19,6 +19,7 @@ ** */ +#include <limits.h> #include <math.h> #include "pm_c_util.h" @@ -446,6 +447,10 @@ main(int argc, char **argv ) { unfilled. We can address that by stretching, whereas the other case would require throwing away some of the input. */ + if (newcols > INT_MAX / SCALE) + pm_error("New image width (%d) is uncomputably large", newcols); + if (newrows > INT_MAX / SCALE) + pm_error("New image height (%d) is uncomputably large", newrows); sxscale = SCALE * newcols / cols; syscale = SCALE * newrows / rows; |