diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-10-07 20:31:51 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-10-07 20:31:51 +0000 |
commit | ba88b729c83d4d99e6b9cae861044c67cd95997d (patch) | |
tree | 0f32075b3995f612410194315a608ec944300a14 /editor | |
parent | 6b343a0ee4b3816ee5672453d54e694bf8f80d2b (diff) | |
download | netpbm-mirror-ba88b729c83d4d99e6b9cae861044c67cd95997d.tar.gz netpbm-mirror-ba88b729c83d4d99e6b9cae861044c67cd95997d.tar.xz netpbm-mirror-ba88b729c83d4d99e6b9cae861044c67cd95997d.zip |
fix arithmetic overflow
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4734 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-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; |