summaryrefslogtreecommitdiffstats
path: root/generic/tclInterp.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-11-23 01:22:50 (GMT)
committerhobbs <hobbs>2002-11-23 01:22:50 (GMT)
commitb56bfc9dd2b0556ccc280a089ad5f815b86cae2d (patch)
tree6c4800d302936f5d02e10350f1807f6e9db635da /generic/tclInterp.c
parentada87b51edc6c26dcb7261164f7092a397ba120c (diff)
downloadtcl-b56bfc9dd2b0556ccc280a089ad5f815b86cae2d.zip
tcl-b56bfc9dd2b0556ccc280a089ad5f815b86cae2d.tar.gz
tcl-b56bfc9dd2b0556ccc280a089ad5f815b86cae2d.tar.bz2
* tests/interp.test: interp-14.4
* generic/tclInterp.c (TclPreventAliasLoop): prevent seg fault when creating an alias command over the interp name. [Bug #641195]
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r--generic/tclInterp.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index cd61b06..8a7a2ca 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInterp.c,v 1.18 2002/09/03 16:31:32 msofer Exp $
+ * RCS: @(#) $Id: tclInterp.c,v 1.19 2002/11/23 01:22:50 hobbs Exp $
*/
#include "tclInt.h"
@@ -1063,7 +1063,7 @@ TclPreventAliasLoop(interp, cmdInterp, cmd)
Alias *aliasPtr, *nextAliasPtr;
Tcl_Command aliasCmd;
Command *aliasCmdPtr;
-
+
/*
* If we are not creating or renaming an alias, then it is
* always OK to create or rename the command.
@@ -1089,6 +1089,18 @@ TclPreventAliasLoop(interp, cmdInterp, cmd)
* the source alias, we have a loop.
*/
+ if (((Interp *)(nextAliasPtr->targetInterp))->flags & DELETED) {
+ /*
+ * The slave interpreter can be deleted while creating the alias.
+ * [Bug #641195]
+ */
+
+ Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
+ "cannot define or rename alias \"",
+ Tcl_GetString(aliasPtr->namePtr),
+ "\": interpreter deleted", (char *) NULL);
+ return TCL_ERROR;
+ }
cmdNamePtr = nextAliasPtr->objPtr;
aliasCmd = Tcl_FindCommand(nextAliasPtr->targetInterp,
Tcl_GetString(cmdNamePtr),
@@ -1153,12 +1165,11 @@ AliasCreate(interp, slaveInterp, masterInterp, namePtr, targetNamePtr,
{
Alias *aliasPtr;
Tcl_HashEntry *hPtr;
- int new;
Target *targetPtr;
Slave *slavePtr;
Master *masterPtr;
- int i;
Tcl_Obj **prefv;
+ int new, i;
aliasPtr = (Alias *) ckalloc((unsigned) (sizeof(Alias)
+ objc * sizeof(Tcl_Obj *)));
@@ -1210,7 +1221,7 @@ AliasCreate(interp, slaveInterp, masterInterp, namePtr, targetNamePtr,
return TCL_ERROR;
}
-
+
/*
* Make an entry in the alias table. If it already exists delete
* the alias command. Then retry.