diff options
| -rw-r--r-- | generic/tclListObj.c | 2 | ||||
| -rw-r--r-- | tests/lseq.test | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 94322f2..6c7f128 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -2637,7 +2637,7 @@ TclLindexFlat( if (TclHasInternalRep(listObj,&tclArithSeriesType)) { Tcl_Size listLen = TclArithSeriesObjLength(listObj); Tcl_Size index; - Tcl_Obj *elemObj = NULL; + Tcl_Obj *elemObj = listObj; /* for lindex without indices return list */ for (i=0 ; i<indexCount && listObj ; i++) { if (TclGetIntForIndexM(interp, indexArray[i], /*endValue*/ listLen-1, &index) == TCL_OK) { diff --git a/tests/lseq.test b/tests/lseq.test index 2a7de67..c2264da 100644 --- a/tests/lseq.test +++ b/tests/lseq.test @@ -674,6 +674,13 @@ test lseq-4.19 {varnames} -body { unset {*}$varlist res varlist v plist } -result {auto_execok 1 auto_load 2 auto_qualify 2 arithseries} +test lseq-4.20 {lindex on lseq without index args, bug a9625d1f53554f9d} -body { + set res [lindex [lseq 1000]] + list [llength $res] [lindex $res 0] [lindex $res end] +} -cleanup { + unset -nocomplain res +} -result {1000 0 999} + test lseq-convertToList {does not result in a memory error} -body { trace add variable var1 write [list ::apply [list args { error {this is an error} |
