summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-06 09:07:44 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-06 09:07:44 (GMT)
commit43d2194943b8bb2c3080092a8219e3923b51f9bf (patch)
tree8a23748849337838554e197c6caa21f18b5e346d
parentb7887ba10345840eb836de5bac3901a14b7099a9 (diff)
downloadtcl-43d2194943b8bb2c3080092a8219e3923b51f9bf.zip
tcl-43d2194943b8bb2c3080092a8219e3923b51f9bf.tar.gz
tcl-43d2194943b8bb2c3080092a8219e3923b51f9bf.tar.bz2
Fix [57daa91ea]: Tcl_GetIntForIndex handling of n-m (m > n). With testcases.
-rw-r--r--generic/tclUtil.c2
-rw-r--r--tests/indexObj.test6
2 files changed, 6 insertions, 2 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 9c1bb93..0119243 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3972,8 +3972,6 @@ GetEndOffsetFromObj(
if (offset == WIDE_MAX) {
*widePtr = (endValue == -1) ? WIDE_MAX : endValue + 1;
- } else if (offset == WIDE_MIN) {
- *widePtr = -1;
} else if (endValue == -1) {
*widePtr = offset;
} else if (offset < 0) {
diff --git a/tests/indexObj.test b/tests/indexObj.test
index eec5485..29fc616 100644
--- a/tests/indexObj.test
+++ b/tests/indexObj.test
@@ -238,6 +238,12 @@ test indexObj-8.16 {Tcl_GetIntForIndex integer} testgetintforindex {
test indexObj-8.17 {Tcl_GetIntForIndex integer} testgetintforindex {
testgetintforindex -2 -1
} -2147483648
+test indexObj-8.18 {Tcl_GetIntForIndex n-m} testgetintforindex {
+ testgetintforindex 2-3 -1
+} -2147483648
+test indexObj-8.19 {Tcl_GetIntForIndex n-m} testgetintforindex {
+ testgetintforindex 2-3 0
+} -1
# cleanup
::tcltest::cleanupTests