This patch fixes a problem with the SlaveObjCmd procedure used within
nested interps.

It can be difficult to reproduce the problem but in tclsh 8.3.4:
% interp create a
% a alias
can give undefined results due to insufficient argument checking. In
some cases this can crash tcl due to dereferencing invalid pointers.

I added a test to check for the desired result of 'a alias' which is an
invalid args error.

Pat Thoyts.


*** generic/tclInterp.c.orig	Thu Oct  4 21:02:20 2001
--- generic/tclInterp.c	Thu Oct  4 21:15:59 2001
***************
*** 1856,1871 ****
  
      switch ((enum options) index) {
  	case OPT_ALIAS: {
! 	    if (objc == 3) {
! 		return AliasDescribe(interp, slaveInterp, objv[2]);
! 	    }
! 	    if (Tcl_GetString(objv[3])[0] == '\0') {
! 		if (objc == 4) {
! 		    return AliasDelete(interp, slaveInterp, objv[2]);
  		}
- 	    } else {
- 		return AliasCreate(interp, slaveInterp, interp, objv[2],
- 			objv[3], objc - 4, objv + 4);
  	    }
  	    Tcl_WrongNumArgs(interp, 2, objv,
  		    "aliasName ?targetName? ?args..?");
--- 1856,1873 ----
  
      switch ((enum options) index) {
  	case OPT_ALIAS: {
! 	    if (objc > 2) {
! 		if (objc == 3) {
! 		    return AliasDescribe(interp, slaveInterp, objv[2]);
! 		}
! 		if (Tcl_GetString(objv[3])[0] == '\0') {
! 		    if (objc == 4) {
! 			return AliasDelete(interp, slaveInterp, objv[2]);
! 		    }
! 		} else {
! 		    return AliasCreate(interp, slaveInterp, interp, objv[2],
! 				       objv[3], objc - 4, objv + 4);
  		}
  	    }
  	    Tcl_WrongNumArgs(interp, 2, objv,
  		    "aliasName ?targetName? ?args..?");
*** tests/interp.test.orig	Thu Oct  4 21:34:09 2001
--- tests/interp.test	Thu Oct  4 21:35:38 2001
***************
*** 271,276 ****
--- 271,281 ----
      a alias bar in_master a1 a2 a3
      a eval bar s1 s2 s3
  } {seen in master: {a1 a2 a3 s1 s2 s3}}
+ test interp-8.3 {testing basic alias invocation} {
+    catch {interp create a}
+    catch {a alias} msg
+    string match "wrong # args*" $msg
+ } {1}
  
  # Part 8: Testing aliases for non-existent targets
  test interp-9.1 {testing aliases for non-existent targets} {
