diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-08-13 11:56:12 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-08-13 11:56:12 (GMT) |
commit | e2d5a2cd606bb2952ffe3c2f00fdcc0132b57130 (patch) | |
tree | 39da0c77e31060d81deb9f63f75cc5e0309855dd /generic/tclListObj.c | |
parent | 5860a8926709c0d0c4fad457796af2b666a39ca1 (diff) | |
download | tcl-e2d5a2cd606bb2952ffe3c2f00fdcc0132b57130.zip tcl-e2d5a2cd606bb2952ffe3c2f00fdcc0132b57130.tar.gz tcl-e2d5a2cd606bb2952ffe3c2f00fdcc0132b57130.tar.bz2 |
Merge in fix for end+1 indices.
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r-- | generic/tclListObj.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index dac75d4..fd69c96 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -2927,6 +2927,14 @@ TclLsetFlat( } indexArray++; + /* + * Special case 0-length lists. The Tcl indexing function treat + * will return any value beyond length as TCL_SIZE_MAX for this + * case. + */ + if ((index == TCL_SIZE_MAX) && (elemCount == 0)) { + index = 0; + } if (index < 0 || index > elemCount || (valueObj == NULL && index >= elemCount)) { /* ...the index points outside the sublist. */ |