summaryrefslogtreecommitdiffstats
path: root/generic/tclArithSeries.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclArithSeries.c')
-rwxr-xr-xgeneric/tclArithSeries.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c
index c3c44f3..5c4e5a5 100755
--- a/generic/tclArithSeries.c
+++ b/generic/tclArithSeries.c
@@ -723,9 +723,27 @@ TclArithSeriesObjRange(
return obj;
}
- TclArithSeriesObjIndex(arithSeriesPtr, fromIdx, &startObj);
+ if (TclArithSeriesObjIndex(arithSeriesPtr, fromIdx, &startObj) != TCL_OK) {
+ if (interp) {
+ Tcl_SetObjResult(
+ interp,
+ Tcl_ObjPrintf("index %d is out of bounds 0 to %"
+ TCL_LL_MODIFIER "d", fromIdx, (arithSeriesRepPtr->len-1)));
+ Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
+ }
+ return NULL;
+ }
Tcl_IncrRefCount(startObj);
- TclArithSeriesObjIndex(arithSeriesPtr, toIdx, &endObj);
+ if (TclArithSeriesObjIndex(arithSeriesPtr, toIdx, &endObj) != TCL_OK) {
+ if (interp) {
+ Tcl_SetObjResult(
+ interp,
+ Tcl_ObjPrintf("index %d is out of bounds 0 to %"
+ TCL_LL_MODIFIER "d", fromIdx, (arithSeriesRepPtr->len-1)));
+ Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
+ }
+ return NULL;
+ }
Tcl_IncrRefCount(endObj);
TclArithSeriesObjStep(arithSeriesPtr, &stepObj);
Tcl_IncrRefCount(stepObj);