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-02 20:34:18 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-02 20:34:18 +0000
commitf4a966318d7275a4e17339866cffc644b2ee674e (patch)
tree6c070b26e1075a2fa2432c179a17a5a78f4c4d3c /converter/other
parentb768cb11aa4cbf3b419aae2ae2b9da854f92cfd2 (diff)
downloadnetpbm-mirror-f4a966318d7275a4e17339866cffc644b2ee674e.tar.gz
netpbm-mirror-f4a966318d7275a4e17339866cffc644b2ee674e.tar.xz
netpbm-mirror-f4a966318d7275a4e17339866cffc644b2ee674e.zip
Fix arithmetic overflow
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4628 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rw-r--r--converter/other/tifftopnm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c
index 0c301a4a..e8f076a4 100644
--- a/converter/other/tifftopnm.c
+++ b/converter/other/tifftopnm.c
@@ -1372,6 +1372,9 @@ convertRasterByRows(pnmOut *       const pnmOutP,
     if (scanbuf == NULL)
         pm_error("can't allocate memory for scanline buffer");
 
+    if (UINT_MAX/cols < spp)
+        pm_error("Image is too wide/deep (%u x %u) for computations",
+                 cols, spp);
     MALLOCARRAY(samplebuf, cols * spp);
     if (samplebuf == NULL)
         pm_error("can't allocate memory for row buffer");