summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2024-06-13 14:39:03 (GMT)
committersebres <sebres@users.sourceforge.net>2024-06-13 14:39:03 (GMT)
commit330e847f377a469a583d704efae21b961ae76f26 (patch)
tree10e972fc1508f89d9862306a6fb22a8505a917ce
parent25613839e74db1287b8046987fde5f633f2a629f (diff)
downloadtcl-330e847f377a469a583d704efae21b961ae76f26.zip
tcl-330e847f377a469a583d704efae21b961ae76f26.tar.gz
tcl-330e847f377a469a583d704efae21b961ae76f26.tar.bz2
fixes [1095bf7f756f9aed]: safe ensemble commands will be compiled now in safe interp too
-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;