diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-03-26 02:08:27 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-03-26 02:08:27 +0000 |
commit | 6eb703682111782bbf570769d907e588f2d59385 (patch) | |
tree | 62085f7a401925eb87be0c838b60b6f138cf08ba /converter/other | |
parent | 019d5e1f88cb5d889a99bb26f733ce476cf9342d (diff) | |
download | netpbm-mirror-6eb703682111782bbf570769d907e588f2d59385.tar.gz netpbm-mirror-6eb703682111782bbf570769d907e588f2d59385.tar.xz netpbm-mirror-6eb703682111782bbf570769d907e588f2d59385.zip |
Release 10.73.31
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3776 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rw-r--r-- | converter/other/pbmtopgm.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/converter/other/pbmtopgm.c b/converter/other/pbmtopgm.c index 69b20fb2..c35e1cbe 100644 --- a/converter/other/pbmtopgm.c +++ b/converter/other/pbmtopgm.c @@ -3,6 +3,7 @@ */ #include <stdio.h> +#include <limits.h> #include "pm_c_util.h" #include "pgm.h" @@ -29,8 +30,13 @@ main(int argc, char *argv[]) { height = atoi(argv[2]); if (width < 1 || height < 1) pm_error("width and height must be > 0"); + if (width > INT_MAX / height) + /* prevent overflow of "value" below */ + pm_error("sample area (%u columns %u rows) too large", + width, height); + left=width/2; right=width-left; - up=width/2; down=height-up; + up=height/2; down=height-up; if (argc == 4) ifd = pm_openr(argv[3]); |