diff options
Diffstat (limited to 'generic')
| -rw-r--r-- | generic/tclListObj.c | 3 | ||||
| -rw-r--r-- | generic/tclUtil.c | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index d3e4f02..0fd489c 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -2871,6 +2871,9 @@ TclLsetFlat( } indexArray++; + if ((index == INT_MAX) && (elemCount == 0)) { + index = 0; + } if (index < 0 || index > elemCount || (valueObj == NULL && index >= elemCount)) { /* ...the index points outside the sublist. */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 30ae39a..074614f 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3660,6 +3660,9 @@ GetWideForIndex( if (numType == TCL_NUMBER_INT) { /* objPtr holds an integer in the signed wide range */ *widePtr = *(Tcl_WideInt *)cd; + if ((*widePtr < 0)) { + *widePtr = WIDE_MIN; + } return TCL_OK; } if (numType == TCL_NUMBER_BIG) { @@ -3966,7 +3969,7 @@ GetEndOffsetFromObj( offset = irPtr->wideValue; if (offset == WIDE_MAX) { - *widePtr = endValue + 1; + *widePtr = (endValue == (size_t)-1) ? WIDE_MAX : endValue + 1; } else if (offset == WIDE_MIN) { *widePtr = -1; } else if (endValue == (size_t)-1) { |
