[Python-checkins] CVS: python/dist/src/Include pythonrun.h,2.32,2.33

Fredrik Lundh python-dev@python.org
Sun, 27 Aug 2000 12:15:33 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory slayer.i.sourceforge.net:/tmp/cvs-serv28530/Include

Modified Files:
	pythonrun.h 
Log Message:


implements PyOS_CheckStack for Windows and MSVC.  this fixes a
couple of potential stack overflows, including bug #110615.

closes patch #101238 


Index: pythonrun.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v
retrieving revision 2.32
retrieving revision 2.33
diff -C2 -r2.32 -r2.33
*** pythonrun.h	2000/08/07 21:00:42	2.32
--- pythonrun.h	2000/08/27 19:15:30	2.33
***************
*** 88,93 ****
  extern DL_IMPORT(int) (*PyOS_InputHook)(void);
  extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *);
  #ifdef USE_STACKCHECK
! int PyOS_CheckStack(void);		/* Check that we aren't overflowing our stack */
  #endif
  
--- 88,105 ----
  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
! /* Check that we aren't overflowing our stack */
! DL_IMPORT(int) PyOS_CheckStack(void);
  #endif