diff Include/pythonrun.h @ 14227:9f9f3280dc68 legacy-trunk

implements PyOS_CheckStack for Windows and MSVC. this fixes a couple of potential stack overflows, including bug #110615. closes patch #101238
author Fredrik Lundh <fredrik@pythonware.com>
date Sun, 27 Aug 2000 19:15:31 +0000
parents c0c17347da5b
children 20377f15b96a
line wrap: on
line diff
--- a/Include/pythonrun.h	Sun Aug 27 19:01:33 2000 +0000
+++ b/Include/pythonrun.h	Sun Aug 27 19:15:31 2000 +0000
@@ -87,8 +87,20 @@
 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