summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclCompCmdsSZ.c2
-rw-r--r--tests/tailcall.test7
2 files changed, 8 insertions, 1 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 383abc2..355c741 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -2618,7 +2618,7 @@ TclCompileTailcallCmd(
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
int i;
- if (parsePtr->numWords < 2 || parsePtr->numWords > 256
+ if (parsePtr->numWords < 2 || parsePtr->numWords >= 256
|| envPtr->procPtr == NULL) {
return TCL_ERROR;
}
diff --git a/tests/tailcall.test b/tests/tailcall.test
index 3704333..35a7268 100644
--- a/tests/tailcall.test
+++ b/tests/tailcall.test
@@ -708,6 +708,13 @@ test tailcall-14.1-bc {{in a deleted namespace} {byte compiled}} -body {
}
} -returnCodes 1 -result {namespace "::ns" not found}
+test tailcall-bug-784befb0ba {tailcall crash with 254 args} -body {
+ proc tccrash args {llength $args}
+ # Must be EXACTLY 254 for crash
+ proc p {} [list tailcall tccrash {*}[lrepeat 254 x]]
+ p
+} -result 254
+
# cleanup
::tcltest::cleanupTests