summaryrefslogtreecommitdiffstats
path: root/generic/tclInterp.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2024-05-25 15:18:54 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2024-05-25 15:18:54 (GMT)
commit3e56737166b9ae9be21274b4ff4c0318b19ff1a3 (patch)
treee0104f8b9288c485d113532e8948559e93c9f649 /generic/tclInterp.c
parent91c53be5fbab2ed2a60452e14a51159be9d9a208 (diff)
downloadtcl-3e56737166b9ae9be21274b4ff4c0318b19ff1a3.zip
tcl-3e56737166b9ae9be21274b4ff4c0318b19ff1a3.tar.gz
tcl-3e56737166b9ae9be21274b4ff4c0318b19ff1a3.tar.bz2
Check limits immediately when we do [interp eval]. [e3f4a8b78d]
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r--generic/tclInterp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index b0f6207..ddca212 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -2795,6 +2795,18 @@ ChildEval(
Tcl_Preserve(childInterp);
Tcl_AllowExceptions(childInterp);
+ /*
+ * If we're transferring to another interpreter, check it's limits first.
+ * It's much more reliable to do that now rather than waiting for the
+ * intermittent checks done during running; the slight performance hit for
+ * a cross-interp call is not a big problem. [Bug e3f4a8b78d]
+ */
+
+ if (interp != childInterp && Tcl_LimitCheck(childInterp) != TCL_OK) {
+ result = TCL_ERROR;
+ goto done;
+ }
+
if (objc == 1) {
/*
* TIP #280: Make actual argument location available to eval'd script.
@@ -2813,6 +2825,7 @@ ChildEval(
result = Tcl_EvalObjEx(childInterp, objPtr, 0);
Tcl_DecrRefCount(objPtr);
}
+ done:
Tcl_TransferResult(childInterp, result, interp);
Tcl_Release(childInterp);