about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--converter/other/tifftopnm.c3
-rw-r--r--doc/HISTORY2
2 files changed, 5 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");
diff --git a/doc/HISTORY b/doc/HISTORY
index 23d7c759..6214705f 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -58,6 +58,8 @@ not yet  BJH  Release 11.04.00
 
               pbmtopgm: Fix error message for excessive -width.
 
+              tifftopnm: Fix incorrect output with really wide/deep rows.
+
               library: add check of maxval for computable size.
 
               Build: Include LDFLAGS in link of shared library.