From 43d2194943b8bb2c3080092a8219e3923b51f9bf Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 6 Jun 2024 09:07:44 +0000 Subject: Fix [57daa91ea]: Tcl_GetIntForIndex handling of n-m (m > n). With testcases. --- generic/tclUtil.c | 2 -- tests/indexObj.test | 6 ++++++ 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 -- cgit v0.12