From b768cb11aa4cbf3b419aae2ae2b9da854f92cfd2 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 1 Sep 2023 18:39:24 +0000 Subject: Fix arithmetic overflow git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4626 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/sirtopnm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'converter') 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) -- cgit 1.4.1