summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-08-30 00:23:16 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-08-30 00:23:16 (GMT)
commitb8db328a5dc663435c02e2b2a67f3d66e16602c9 (patch)
tree7190b01a6ab49b73109282aaa892db8e46c80128 /generic
parent962035b9e88c81c37b472d73da55dbba9534756a (diff)
parentc920fce750db18f523a53b78892cb2c1610f5fcc (diff)
downloadtcl-b8db328a5dc663435c02e2b2a67f3d66e16602c9.zip
tcl-b8db328a5dc663435c02e2b2a67f3d66e16602c9.tar.gz
tcl-b8db328a5dc663435c02e2b2a67f3d66e16602c9.tar.bz2
[Bug 3398794]: Use Tcl errors in scripts, not panics.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclInterp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index a156a57..5b6d14f 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -4345,6 +4345,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;
@@ -4519,6 +4532,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;