about summary refs log tree commit diff
path: root/converter/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-01 18:39:24 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-01 18:39:24 +0000
commitb768cb11aa4cbf3b419aae2ae2b9da854f92cfd2 (patch)
treeac2dd68c0d08b879b20abe3c5aa173c847ee9a7e /converter/other
parent5aa834adf317acf463fe360e0b328fd6b3321ce9 (diff)
downloadnetpbm-mirror-b768cb11aa4cbf3b419aae2ae2b9da854f92cfd2.tar.gz
netpbm-mirror-b768cb11aa4cbf3b419aae2ae2b9da854f92cfd2.tar.xz
netpbm-mirror-b768cb11aa4cbf3b419aae2ae2b9da854f92cfd2.zip
Fix arithmetic overflow
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4626 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rw-r--r--converter/other/sirtopnm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/converter/other/sirtopnm.c b/converter/other/sirtopnm.c
index d7bda045..6a36a110 100644
--- a/converter/other/sirtopnm.c
+++ b/converter/other/sirtopnm.c
@@ -90,6 +90,10 @@ convertPpm(FILE *       const ifP,
     unsigned char * sirarray;  /* malloc'ed array */
     unsigned int row;
 
+    if (UINT_MAX/cols/rows < 3)
+        pm_error("Image is too large (%u x %u x %u) for computation",
+                 cols, rows, 3);
+
     MALLOCARRAY(sirarray, picsize);
 
     if (!sirarray)