Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 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 | 999671f69df4 |
| children | 20377f15b96a |
comparison
equal
deleted
inserted
replaced
| 14226:11a26e963dc9 | 14227:9f9f3280dc68 |
|---|---|
| 1163 return 0; | 1163 return 0; |
| 1164 return (filename == NULL) || | 1164 return (filename == NULL) || |
| 1165 (strcmp(filename, "<stdin>") == 0) || | 1165 (strcmp(filename, "<stdin>") == 0) || |
| 1166 (strcmp(filename, "???") == 0); | 1166 (strcmp(filename, "???") == 0); |
| 1167 } | 1167 } |
| 1168 | |
| 1169 | |
| 1170 #if defined(USE_STACKCHECK) | |
| 1171 #if defined(WIN32) && defined(_MSC_VER) | |
| 1172 | |
| 1173 /* Stack checking for Microsoft C */ | |
| 1174 | |
| 1175 #include <malloc.h> | |
| 1176 #include <excpt.h> | |
| 1177 | |
| 1178 int | |
| 1179 PyOS_CheckStack() | |
| 1180 { | |
| 1181 __try { | |
| 1182 /* _alloca throws a stack overflow exception if there's | |
| 1183 not enough space left on the stack */ | |
| 1184 _alloca(PYOS_STACK_MARGIN * sizeof(void*)); | |
| 1185 return 0; | |
| 1186 } __except (EXCEPTION_EXECUTE_HANDLER) { | |
| 1187 /* just ignore all errors */ | |
| 1188 } | |
| 1189 return 1; | |
| 1190 } | |
| 1191 | |
| 1192 #endif /* WIN32 && _MSC_VER */ | |
| 1193 | |
| 1194 /* Alternate implementations can be added here... */ | |
| 1195 | |
| 1196 #endif /* USE_STACKCHECK */ |
