summaryrefslogtreecommitdiff
path: root/lang/tcl85/files/patch-bug214205
blob: d3176230cc9ea76ae4d9696b6543b746e05fd0e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
--- ../generic/tclListObj.c.orig	2021-09-10 06:40:10 UTC
+++ ../generic/tclListObj.c
@@ -846,11 +846,8 @@
     }
     if (count < 0) {
 	count = 0;
-    } else if (numElems < first+count || first+count < 0) {
-	/*
-	 * The 'first+count < 0' condition here guards agains integer
-	 * overflow in determining 'first+count'
-	 */
+    } else if (first > INT_MAX - count /* Handle integer overflow */
+	    || numElems < first+count) {
 	count = numElems - first;
     }