From 2e8e9e285ffdd33bb74f2171151867bb92954364 Mon Sep 17 00:00:00 2001 From: dah Date: Sun, 18 Dec 2016 15:39:29 +0000 Subject: More comments, fix bug where numArgs should be argCt --- generic/tclProc.c | 16 +++++++++++----- 1 file 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]; /* -- cgit v0.12