about summary refs log tree commit diff
path: root/editor/pamcut.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-11-07 01:33:26 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-11-07 01:33:26 +0000
commit42efa67c47521596088768d82f5665b15d03d6bf (patch)
tree358e75c107ff9ef1a45e3f4a15085d1f3f7a7a42 /editor/pamcut.c
parent109fb3ec30eaca9ce3427d58a2b8fb1c038a7c4f (diff)
downloadnetpbm-mirror-42efa67c47521596088768d82f5665b15d03d6bf.tar.gz
netpbm-mirror-42efa67c47521596088768d82f5665b15d03d6bf.tar.xz
netpbm-mirror-42efa67c47521596088768d82f5665b15d03d6bf.zip
fix arithmetic overflows
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4177 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pamcut.c')
-rw-r--r--editor/pamcut.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/pamcut.c b/editor/pamcut.c
index 1fc9d9b2..7870fd70 100644
--- a/editor/pamcut.c
+++ b/editor/pamcut.c
@@ -712,7 +712,7 @@ extractRowsPBM(const struct pam * const inpamP,
 
     if (leftcol > 0) {
         totalWidth = MAX(rightcol+1, inpamP->width) + 7;
-        if (totalWidth > INT_MAX)
+        if (totalWidth > INT_MAX - 10)
             /* Prevent overflows in pbm_allocrow_packed() */
             pm_error("Specified right edge is too far "
                      "from the right end of input image");
@@ -721,7 +721,7 @@ extractRowsPBM(const struct pam * const inpamP,
         writeOffset = leftcol;
     } else {
         totalWidth = -leftcol + MAX(rightcol+1, inpamP->width);
-        if (totalWidth > INT_MAX)
+        if (totalWidth > INT_MAX - 10)
             pm_error("Specified left/right edge is too far "
                      "from the left/right end of input image");