diff options
author | dkf <dkf@noemail.net> | 2009-12-29 13:13:17 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2009-12-29 13:13:17 (GMT) |
commit | 81df62f1941dcc5c354ccb7b3a1433cd58c11c02 (patch) | |
tree | 91433bca2e8f90eb8c420ae39a1d45d8d3eac575 /generic/tclInterp.c | |
parent | dd6321da42ee4fa566ad92d075775f77a4d22648 (diff) | |
download | tcl-81df62f1941dcc5c354ccb7b3a1433cd58c11c02.zip tcl-81df62f1941dcc5c354ccb7b3a1433cd58c11c02.tar.gz tcl-81df62f1941dcc5c354ccb7b3a1433cd58c11c02.tar.bz2 |
[Bug 2895741]: Make min() and max() supported in safe interpreters.
FossilOrigin-Name: e6c8bcd32e2f4d349176a6c7f057f22a406db926
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r-- | generic/tclInterp.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 6ff8cea..e7ad80d 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -10,7 +10,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.83.2.3 2009/12/28 10:05:22 dkf Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.83.2.4 2009/12/29 13:13:18 dkf Exp $ */ #include "tclInt.h" @@ -2817,9 +2817,26 @@ Tcl_MakeSafe( { Tcl_Channel chan; /* Channel to remove from safe interpreter. */ Interp *iPtr = (Interp *) interp; + Tcl_Interp *master = ((InterpInfo*) iPtr->interpInfo)->slave.masterInterp; TclHideUnsafeCommands(interp); + if (master != NULL) { + /* + * Alias these function implementations in the slave to those in the + * master; the overall implementations are safe, but they're normally + * defined by init.tcl which is not sourced by safe interpreters. + * Assume these functions all work. [Bug 2895741] + */ + + (void) Tcl_Eval(interp, + "namespace eval ::tcl {namespace eval mathfunc {}}"); + (void) Tcl_CreateAlias(interp, "::tcl::mathfunc::min", master, + "::tcl::mathfunc::min", 0, NULL); + (void) Tcl_CreateAlias(interp, "::tcl::mathfunc::max", master, + "::tcl::mathfunc::max", 0, NULL); + } + iPtr->flags |= SAFE_INTERP; /* |