From f4a966318d7275a4e17339866cffc644b2ee674e Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 2 Sep 2023 20:34:18 +0000 Subject: Fix arithmetic overflow git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4628 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/tifftopnm.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'converter/other') 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"); -- cgit 1.4.1