Skip to content

Commit

Permalink
Fix bug-99e834bf33
Browse files Browse the repository at this point in the history
  • Loading branch information
griffin committed Sep 29, 2022
2 parents 831db9a + 31eac27 commit c909454
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion generic/tclExecute.c
Original file line number Diff line number Diff line change
Expand Up @@ -4728,7 +4728,7 @@ TEBCresume(

/* Decode end-offset index values. */

index = TclIndexDecode(opnd, length);
index = TclIndexDecode(opnd, length-1);

/* Compute value @ index */
if (index < length) {
Expand Down
12 changes: 11 additions & 1 deletion tests/lseq.test
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,18 @@ test lseq-4.4 {lseq corner case} -body {
lappend res $s $e
}
eval $tcmd
} -cleanup {
unset res
} -result {0 10 0 10 0 9223372036854774991 0 10 0 2147483638}
# {0 10 1 {max length of a Tcl list exceeded} 1 {max length of a Tcl list exceeded} 0 10 0 2147483638}

# Ticket 99e834bf33 - lseq, lindex end off by one

test lseq-4.5 {lindex off by one} -body {
lappend res [eval {lindex [lseq 1 4] end}]
lappend res [eval {lindex [lseq 1 4] end-1}]
} -cleanup {
unset res
} -result {4 3}


# cleanup
Expand Down

0 comments on commit c909454

Please sign in to comment.