summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordah <dunnie@gmail.com>2016-12-18 15:39:29 (GMT)
committerdah <dunnie@gmail.com>2016-12-18 15:39:29 (GMT)
commit2e8e9e285ffdd33bb74f2171151867bb92954364 (patch)
treeebd0a73cf837590647e7e9d6b410c3cd58aadf28
parent6127d0ae1c48c00e21584b66a79c21727291ca52 (diff)
downloadtcl-dah_proc_arg_upvar.zip
tcl-dah_proc_arg_upvar.tar.gz
tcl-dah_proc_arg_upvar.tar.bz2
More comments, fix bug where numArgs should be argCtdah_proc_arg_upvar
-rw-r--r--generic/tclProc.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 615515b..db76bc9 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -1613,15 +1613,21 @@ InitArgsAndLocals(
if (TclIsVarLink(defPtr)) {
int argIndex;
- /*
- * Something went horribly wrong if this comes to a Panic.
- */
-
if (TCL_OK != (TclGetIntFromObj(interp, defPtr->value.objPtr,
&argIndex))
- || (argIndex < 0 || argIndex > numArgs - 1)) {
+ || (argIndex < 0 || argIndex > argCt - 1)) {
+ /*
+ * Something went horribly wrong if this comes to a Panic.
+ * Should not happen unless there's an internal bug.
+ */
+
Tcl_Panic("Link variable points to an invalid local index.");
} else {
+ /*
+ * Defaults are illegal for linked arguments, so argIndex
+ * should be safe.
+ */
+
Tcl_Obj *objPtr = argObjs[argIndex];
/*