summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2000-08-27 19:15:31 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2000-08-27 19:15:31 (GMT)
commit2f15b25da2060ab723e0bb82a8f4f713d547b2b8 (patch)
tree09ab0cf972b91f2c24524e927960fd0d23f4bd55 /Include
parent0ae722e0a21e7fff58e94f6b62b6340761312f7e (diff)
downloadcpython-2f15b25da2060ab723e0bb82a8f4f713d547b2b8.zip
cpython-2f15b25da2060ab723e0bb82a8f4f713d547b2b8.tar.gz
cpython-2f15b25da2060ab723e0bb82a8f4f713d547b2b8.tar.bz2
implements PyOS_CheckStack for Windows and MSVC. this fixes a
couple of potential stack overflows, including bug #110615. closes patch #101238
Diffstat (limited to 'Include')
-rw-r--r--Include/pythonrun.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index c217570..0528702 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -87,8 +87,20 @@ DL_IMPORT(void) PyOS_FiniInterrupts(void);
DL_IMPORT(char *) PyOS_Readline(char *);
extern DL_IMPORT(int) (*PyOS_InputHook)(void);
extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *);
+
+/* Stack size, in "pointers" (so we get extra safety margins
+ on 64-bit platforms). On a 32-bit platform, this translates
+ to a 8k margin. */
+#define PYOS_STACK_MARGIN 2048
+
+#if defined(WIN32) && defined(_MSC_VER)
+/* Enable stack checking under Microsoft C */
+#define USE_STACKCHECK
+#endif
+
#ifdef USE_STACKCHECK
-int PyOS_CheckStack(void); /* Check that we aren't overflowing our stack */
+/* Check that we aren't overflowing our stack */
+DL_IMPORT(int) PyOS_CheckStack(void);
#endif
#ifdef __cplusplus