Skip to content

test: trigger crashes with correct WER exception codes#1779

Merged
jpnurmi merged 2 commits into
masterfrom
jpnurmi/test/wer-exception-code
Jun 3, 2026
Merged

test: trigger crashes with correct WER exception codes#1779
jpnurmi merged 2 commits into
masterfrom
jpnurmi/test/wer-exception-code

Conversation

@jpnurmi
Copy link
Copy Markdown
Collaborator

@jpnurmi jpnurmi commented Jun 3, 2026

For stack-buffer-overruns, the example uses RaiseFailFastException as appropriate, but for fastfails, it used __fastfail(77) that makes WER deliver STATUS_STACK_BUFFER_OVERRUN (0xC0000409).

vs.

Originally posted by @cursor[bot] in #1777 (comment)

Wrong exception code for fastfail

Medium Severity

test_native_wer_crash is parametrized with fastfail and stack-buffer-overrun, but always asserts exception code 0xC0000409. The fastfail path uses __fastfail and raises STATUS_FAIL_FAST_EXCEPTION (0xC0000602), so the fastfail case fails the assertion even when capture works.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9c3e82f. Configure here.

NOTE: The CI does not run WER tests. Tested locally:

(.venv) C:\Users\jpnurmi\Projects\sentry\sentry-native>pytest --with_wer -v tests\
================================================= test session starts =================================================
platform win32 -- Python 3.13.3, pytest-9.0.3, pluggy-1.5.0 -- C:\Python313\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\jpnurmi\Projects\sentry\sentry-native
plugins: flaky-3.8.1, pytest_httpserver-1.0.10, xdist-3.8.0
collected 1496 items

tests/test_build_static.py::test_static_lib PASSED                                                               [  0%]
...
==================================== 1460 passed, 36 skipped in 954.19s (0:15:54) =====================================

jpnurmi added 2 commits June 3, 2026 11:52
For stack-buffer-overruns, the example uses `RaiseFailFastException` as
appropriate, but for fastfails, it used `__fastfail(77)` that made WER
deliver `STATUS_STACK_BUFFER_OVERRUN (0xC0000409)`.

- `__fastfail(77)` → `kernel int 0x29` → WER always normalizes to
  `STATUS_STACK_BUFFER_OVERRUN (0xC0000409)`
  https://learn.microsoft.com/en-us/cpp/intrinsics/fastfail

vs.

- `RaiseFailFastException(NULL, NULL, 0)` → WER preserves the original
  exception code `(STATUS_FAIL_FAST_EXCEPTION = 0xC0000602)`
  https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-raisefailfastexception
@jpnurmi jpnurmi merged commit 73a75ae into master Jun 3, 2026
103 of 104 checks passed
@jpnurmi jpnurmi deleted the jpnurmi/test/wer-exception-code branch June 3, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants