summaryrefslogtreecommitdiffstats
path: root/generic/tclInterp.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-08-30 00:05:19 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-08-30 00:05:19 (GMT)
commitc920fce750db18f523a53b78892cb2c1610f5fcc (patch)
treeb5c0fc271ea0fd6dbddade04e906a194ddd9294e /generic/tclInterp.c
parent379048cb89b55b63858d61a573dbe5537b3656e5 (diff)
downloadtcl-c920fce750db18f523a53b78892cb2c1610f5fcc.zip
tcl-c920fce750db18f523a53b78892cb2c1610f5fcc.tar.gz
tcl-c920fce750db18f523a53b78892cb2c1610f5fcc.tar.bz2
[Bug 3398794]: Use Tcl errors in scripts, not panics.
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r--generic/tclInterp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 0b05913..058714f 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -4133,6 +4133,19 @@ SlaveCommandLimitCmd(
ScriptLimitCallback *limitCBPtr;
Tcl_HashEntry *hPtr;
+ /*
+ * First, ensure that we are not reading or writing the calling
+ * interpreter's limits; it may only manipulate its children. Note that
+ * the low level API enforces this with Tcl_Panic, which we want to
+ * avoid. [Bug 3398794]
+ */
+
+ if (interp == slaveInterp) {
+ Tcl_AppendResult(interp,
+ "limits on current interpreter inaccessible", NULL);
+ return TCL_ERROR;
+ }
+
if (objc == consumedObjc) {
Tcl_Obj *dictPtr;
@@ -4304,6 +4317,19 @@ SlaveTimeLimitCmd(
ScriptLimitCallback *limitCBPtr;
Tcl_HashEntry *hPtr;
+ /*
+ * First, ensure that we are not reading or writing the calling
+ * interpreter's limits; it may only manipulate its children. Note that
+ * the low level API enforces this with Tcl_Panic, which we want to
+ * avoid. [Bug 3398794]
+ */
+
+ if (interp == slaveInterp) {
+ Tcl_AppendResult(interp,
+ "limits on current interpreter inaccessible", NULL);
+ return TCL_ERROR;
+ }
+
if (objc == consumedObjc) {
Tcl_Obj *dictPtr;