From 38d236794b78dbda5e93b1c54116528f3af9debc Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 15 Sep 2023 04:23:21 +0000 Subject: Fix arithmetic overflow git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4654 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/pbm/pbmtoxbm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'converter/pbm') diff --git a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c index 5074c0fb..4bd33dd8 100644 --- a/converter/pbm/pbmtoxbm.c +++ b/converter/pbm/pbmtoxbm.c @@ -366,6 +366,10 @@ convertRaster(FILE * const ifP, unsigned char * bitrow; unsigned int row; + if (cols > UINT_MAX - bitsPerUnit) + pm_error("Image is too wide (%u columns) for computations", + cols); + putinit(xbmVersion); bitrow = pbm_allocrow_packed(cols + padright); -- cgit 1.4.1