From aa32dffb962d0159f91f4374a676c66ef63a2fa8 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 20 Oct 2023 21:12:44 +0000 Subject: Fix crash introduced by prior commit git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4770 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- urt/Runput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/urt/Runput.c b/urt/Runput.c index 83250814..d4281bb9 100644 --- a/urt/Runput.c +++ b/urt/Runput.c @@ -203,7 +203,7 @@ RunSetup(rle_hdr * const hdrP) { /* We need to be able to count 2 bytes for each channel of each entry in the color map: */ - if (1 << hdrP->cmaplen > UINT_MAX/2/hdrP->ncmap) { + if (hdrP->ncmap > 0 && 1 << hdrP->cmaplen > UINT_MAX/2/hdrP->ncmap) { pm_error("Color map length %u and number of color channels in the " "color map %u are too large for computation", 1 << hdrP->cmaplen, hdrP->ncmap); -- cgit 1.4.1