summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclEnsemble.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index dea3bed..367a4e5 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -1615,6 +1615,8 @@ TclMakeEnsemble(
Tcl_DStringAppend(&hiddenBuf, map[i].name, -1))) {
Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp)));
}
+ /* don't compile unsafe subcommands in unsafe interp */
+ cmdPtr->compileProc = NULL;
} else {
/*
* Not hidden, so just create it. Yay!
@@ -1624,8 +1626,8 @@ TclMakeEnsemble(
Tcl_NRCreateCommand(interp, TclGetString(toObj),
map[i].proc, map[i].nreProc, map[i].clientData,
NULL);
+ cmdPtr->compileProc = map[i].compileProc;
}
- cmdPtr->compileProc = map[i].compileProc;
}
}
Tcl_SetEnsembleMappingDict(interp, ensemble, mapDict);
@@ -3107,7 +3109,7 @@ TclCompileEnsemble(
Tcl_IncrRefCount(targetCmdObj);
newCmdPtr = (Command *) Tcl_GetCommandFromObj(interp, targetCmdObj);
TclDecrRefCount(targetCmdObj);
- if (newCmdPtr == NULL || Tcl_IsSafe(interp)
+ if (newCmdPtr == NULL || (Tcl_IsSafe(interp) && !cmdPtr->compileProc)
|| newCmdPtr->nsPtr->flags & NS_SUPPRESS_COMPILATION
|| newCmdPtr->flags & CMD_HAS_EXEC_TRACES
|| ((Interp *)interp)->flags & DONT_COMPILE_CMDS_INLINE) {
@@ -3115,7 +3117,6 @@ TclCompileEnsemble(
* Maps to an undefined command or a command without a compiler.
* Cannot compile.
*/
-
goto cleanup;
}
cmdPtr = newCmdPtr;