diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-02-10 07:37:59 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-02-10 07:37:59 +0000 |
commit | ed784035a8c397995f66eac86c8072cb7546643b (patch) | |
tree | 4e6d50d91761e4fe4170c9dbe57ecd4a3f4c2a67 /editor/pamstretch.c | |
parent | 76758a935da3169d8fd556532f4180b109589561 (diff) | |
download | netpbm-mirror-ed784035a8c397995f66eac86c8072cb7546643b.tar.gz netpbm-mirror-ed784035a8c397995f66eac86c8072cb7546643b.tar.xz netpbm-mirror-ed784035a8c397995f66eac86c8072cb7546643b.zip |
Release 10.73.25
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3546 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pamstretch.c')
-rw-r--r-- | editor/pamstretch.c | 16 |
1 files changed, 13 insertions, 3 deletions
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 <string.h> #include <stdlib.h> #include <ctype.h> +#include <limits.h> #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); } |