about summary refs log tree commit diff
path: root/converter/other/tifftopnm.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter/other/tifftopnm.c')
-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");