summaryrefslogtreecommitdiffstats
path: root/generic/tclInterp.c
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2011-08-30 00:05:19 (GMT)
committerdkf <dkf@noemail.net>2011-08-30 00:05:19 (GMT)
commit124b33a383301672b4e6cd357f6ac6ba684d2fb3 (patch)
treeb5c0fc271ea0fd6dbddade04e906a194ddd9294e /generic/tclInterp.c
parent53cb6386c4a50a0139c32b784de08b147a2dac39 (diff)
downloadtcl-124b33a383301672b4e6cd357f6ac6ba684d2fb3.zip
tcl-124b33a383301672b4e6cd357f6ac6ba684d2fb3.tar.gz
tcl-124b33a383301672b4e6cd357f6ac6ba684d2fb3.tar.bz2
[Bug 3398794]: Use Tcl errors in scripts, not panics.
FossilOrigin-Name: b3333814a0462238692d4cd7e19feffe2e3f39ea
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;