From 97e0fd8ab1be6759068456a1f518458acab5a6f5 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 16 Oct 2021 20:39:42 +0000 Subject: Expand headroom for preventing arithmetic overflow from 2 to 10, to allow for rounding up to a multiple of 8 in bitmap computations git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4155 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/libpbm2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/libpbm2.c') diff --git a/lib/libpbm2.c b/lib/libpbm2.c index a35004f9..1ad93534 100644 --- a/lib/libpbm2.c +++ b/lib/libpbm2.c @@ -69,12 +69,12 @@ validateComputableSize(unsigned int const cols, you expect. That failed expectation can be disastrous if you use it to allocate memory. - A common operation is adding 1 or 2 to the highest row or - column number in the image, so we make sure that's possible. + See comments at 'validateComputableSize' in libpam.c for details on + the purpose of these validations. -----------------------------------------------------------------------------*/ - if (cols > INT_MAX - 2) + if (cols > INT_MAX - 10) pm_error("image width (%u) too large to be processed", cols); - if (rows > INT_MAX - 2) + if (rows > INT_MAX - 10) pm_error("image height (%u) too large to be processed", rows); } -- cgit 1.4.1