summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorTrent Mick <trentm@activestate.com>2000-08-16 22:29:55 (GMT)
committerTrent Mick <trentm@activestate.com>2000-08-16 22:29:55 (GMT)
commit239548f37da61f31206f9db912d7897431971b63 (patch)
treed53ab27e950c2e5c8edcfa01d6f516e083eebb8e /Modules/_sre.c
parent1aebadf0e5c8f5c7f8ff994c9ee4dba20115ceec (diff)
downloadcpython-239548f37da61f31206f9db912d7897431971b63.zip
cpython-239548f37da61f31206f9db912d7897431971b63.tar.gz
cpython-239548f37da61f31206f9db912d7897431971b63.tar.bz2
The sre test suite currently overruns the stack on Win64, Linux64, and Monterey
(64-bit AIX) This is because the RECURSION_LIMIT is too low. This patch lowers to recusion limit to 7500 such that the recusion check fires before a segfault. Fredrik suggested/approved the fix in private email, modulo sre's recusion limit checking no being necessary when PyOS_CheckStack is implemented for Windows.
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index b87282c..29e92ac 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -58,9 +58,18 @@ char copyright[] = " SRE 0.9.8 Copyright (c) 1997-2000 by Secret Labs AB ";
/* -------------------------------------------------------------------- */
/* optional features */
-/* prevent run-away recursion (bad patterns on long strings) */
+/* prevent run-away recursion (bad patterns on long strings)
+ Require a smaller recursion limit for a number of 64-bit platforms
+ to prevent stack overflow:
+ Win64 - MS_WIN64, Linux64 - __LP64__, Monterey (64-bit AIX) - _LP64
+ XXX Or maybe this should be defined for all SIZEOF_VOIDP>4 platforms?
+*/
#if !defined(USE_STACKCHECK)
-#define USE_RECURSION_LIMIT 10000
+# if defined(MS_WIN64) || defined(__LP64__) || defined(_LP64)
+# define USE_RECURSION_LIMIT 7500
+# else
+# define USE_RECURSION_LIMIT 10000
+# endif
#endif
/* enables fast searching */