Skip to content

bpo-40458: Increase reserved stack space to prevent overflow crash on Windows #19845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert improved diagnostics
  • Loading branch information
zooba committed May 5, 2020
commit 6c53dd4514a0954aa528cb15ac8fe1ef0e3279ba
2 changes: 1 addition & 1 deletion Lib/test/test_faulthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def test_raise_exception(self):
for exc, name in (
('EXCEPTION_ACCESS_VIOLATION', 'access violation'),
('EXCEPTION_INT_DIVIDE_BY_ZERO', 'int divide by zero'),
('EXCEPTION_STACK_OVERFLOW', r'stack overflow(\s+\(.+\))?'),
('EXCEPTION_STACK_OVERFLOW', 'stack overflow'),
):
self.check_windows_exception(f"""
import faulthandler
Expand Down
12 changes: 1 addition & 11 deletions Modules/faulthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info)
const int fd = fatal_error.fd;
DWORD code = exc_info->ExceptionRecord->ExceptionCode;
DWORD flags = exc_info->ExceptionRecord->ExceptionFlags;
PyThreadState *tstate;

if (faulthandler_ignore_exception(code)) {
/* ignore the exception: call the next exception handler */
Expand All @@ -403,16 +402,7 @@ faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info)
case EXCEPTION_INT_DIVIDE_BY_ZERO: PUTS(fd, "int divide by zero"); break;
case EXCEPTION_INT_OVERFLOW: PUTS(fd, "integer overflow"); break;
case EXCEPTION_IN_PAGE_ERROR: PUTS(fd, "page error"); break;
case EXCEPTION_STACK_OVERFLOW:
PUTS(fd, "stack overflow");
/* call UncheckedGet directly to avoid setting exceptions */
tstate = _PyThreadState_UncheckedGet();
if (tstate != NULL) {
PUTS(fd, " (recursion depth=");
_Py_DumpDecimal(fd, tstate->recursion_depth);
PUTS(fd, ")");
}
break;
case EXCEPTION_STACK_OVERFLOW: PUTS(fd, "stack overflow"); break;
default:
PUTS(fd, "code 0x");
_Py_DumpHexadecimal(fd, code, 8);
Expand Down