summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2004-05-03 17:04:30 (GMT)
committerKevin B Kenny <kennykb@acm.org>2004-05-03 17:04:30 (GMT)
commitd89a3ab9360808277923f70f08aa051dd1dbf3ad (patch)
treee7ce490e7b604bed8884edc92aa5c4595c9e281a
parentde6db8c03eed86af2bd00514dc4da5c321a822ab (diff)
downloadtcl-d89a3ab9360808277923f70f08aa051dd1dbf3ad.zip
tcl-d89a3ab9360808277923f70f08aa051dd1dbf3ad.tar.gz
tcl-d89a3ab9360808277923f70f08aa051dd1dbf3ad.tar.bz2
* win/tclWin32Dll.c (TclpCheckStackSpace):
* tests/stack.test (stack-3.1): Fix for undetected stack overflow in TclReExec on Windows. [Bug 947070]
-rw-r--r--ChangeLog6
-rw-r--r--tests/stack.test32
-rw-r--r--win/tclWinInt.h4
3 files changed, 39 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index de113fd..03b12d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-03 Kevin Kenny <kennykb@acm.org>
+
+ * win/tclWin32Dll.c (TclpCheckStackSpace):
+ * tests/stack.test (stack-3.1): Fix for undetected stack
+ overflow in TclReExec on Windows. [Bug 947070]
+
2004-05-03 Don Porter <dgp@users.sourceforge.net>
* library/init.tcl: Corrected unique prefix matching of
diff --git a/tests/stack.test b/tests/stack.test
index 828352b..dfcf9c2 100644
--- a/tests/stack.test
+++ b/tests/stack.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: stack.test,v 1.15 2002/07/29 00:25:49 msofer Exp $
+# RCS: @(#) $Id: stack.test,v 1.16 2004/05/03 17:04:31 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -55,6 +55,36 @@ test stack-2.1 {maxNestingDepth reached on infinite recursion} {minStack2400} {
set msg
} {too many nested evaluations (infinite loop?)}
+# Make sure that there is enough stack to run regexp even if we're
+# close to the recursion limit. [Bug 947070]
+
+test stack-3.1 {enough room for regexp near recursion limit} \
+ -constraints { win } \
+ -setup {
+ set ::limit [interp recursionlimit {} 10000]
+ set ::depth 0
+ proc a { max } {
+ if { [info level] < $max } {
+ set ::depth [info level]
+ a $max
+ } else {
+ regexp {^ ?} x
+ }
+ }
+ catch { a 10001 }
+ incr depth -2
+ set depth2 $depth
+ } -body {
+ list [catch { a $::depth } result] \
+ $result [expr { $::depth2 - $::depth }]
+ } -cleanup {
+ interp recursionlimit {} $::limit
+ } -result {0 1 1}
+
# cleanup
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/win/tclWinInt.h b/win/tclWinInt.h
index 7dda96d..4f0b6be 100644
--- a/win/tclWinInt.h
+++ b/win/tclWinInt.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinInt.h,v 1.25 2004/04/06 22:25:58 dgp Exp $
+ * RCS: @(#) $Id: tclWinInt.h,v 1.26 2004/05/03 17:04:31 kennykb Exp $
*/
#ifndef _TCLWININT
@@ -22,7 +22,7 @@
* to help avoid overflowing the stack in the case of infinite recursion.
*/
-#define TCL_WIN_STACK_THRESHOLD 0x2000
+#define TCL_WIN_STACK_THRESHOLD 0x8000
#ifdef BUILD_tcl
# undef TCL_STORAGE_CLASS