[PR #903] [CLOSED] shims: guard SEH __try behind _MSC_VER for MinGW (MINGW-SEH-GUARD) #940

Closed
opened 2026-11-26 20:19:34 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/903
Author: @morodirule
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: fix/mingw-seh-guard


📝 Commits (3)

  • 93511b1 shims: guard SEH __try behind _MSC_VER for MinGW (MINGW-SEH-GUARD)
  • 7e47b21 dstorage: reject wrapped MinGW buffer ranges before VirtualQuery
  • 85c78e2 dstorage: let MinGW guarded_move reach guard pages like MSVC

📊 Changes

2 files changed (+57 additions, -0 deletions)

View changed files

📝 runtime/shims/dstorage.cpp (+47 -0)
📝 runtime/shims/file_system.cpp (+10 -0)

📄 Description

Claimed in the coordination issue as: MINGW-SEH-GUARD

Carries abnalstlll-byte's finding (file_system.cpp touch_pages); the same unguarded __try also blocked dstorage.cpp guarded_move and touch_pages, so all three sites are guarded.

Change: the three __try/__except blocks are now #ifdef _MSC_VER, following the existing startup_trace.h pattern. Other compilers probe with VirtualQuery: touch_pages treats a non-committed/guarded page as untouched (ReadFile refuses it as before); guarded_move returns false when a source page is unreadable or a destination page unwritable, keeping its E_DSTORAGE_ACCESS_VIOLATION contract. The MSVC branch is unchanged (diff is +45/-0).

Tests: x86_64-w64-mingw32-g++ -fsyntax-only and -c -O1 of both translation units pass (baseline: error: expected 'catch' before '__except' in both files). Linux native build unaffected (Windows-only shims; not in the portable subset). check_no_game_data.py PASS. No game files, no GPU. MSVC compile not available on this machine.

AI-assisted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/903 **Author:** [@morodirule](https://github.com/morodirule) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/mingw-seh-guard` --- ### 📝 Commits (3) - [`93511b1`](https://github.com/ubiquitarianism/leonida/commit/93511b1faa1e944126364caf16b3d96e4854b70e) shims: guard SEH __try behind _MSC_VER for MinGW (MINGW-SEH-GUARD) - [`7e47b21`](https://github.com/ubiquitarianism/leonida/commit/7e47b210dac7bbd33948059239e34b53272780e2) dstorage: reject wrapped MinGW buffer ranges before VirtualQuery - [`85c78e2`](https://github.com/ubiquitarianism/leonida/commit/85c78e20f716a5bdf3d43a93e7ccf74def38fc7b) dstorage: let MinGW guarded_move reach guard pages like MSVC ### 📊 Changes **2 files changed** (+57 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/dstorage.cpp` (+47 -0) 📝 `runtime/shims/file_system.cpp` (+10 -0) </details> ### 📄 Description Claimed in the coordination issue as: MINGW-SEH-GUARD Carries abnalstlll-byte's finding (file_system.cpp touch_pages); the same unguarded __try also blocked dstorage.cpp guarded_move and touch_pages, so all three sites are guarded. Change: the three __try/__except blocks are now #ifdef _MSC_VER, following the existing startup_trace.h pattern. Other compilers probe with VirtualQuery: touch_pages treats a non-committed/guarded page as untouched (ReadFile refuses it as before); guarded_move returns false when a source page is unreadable or a destination page unwritable, keeping its E_DSTORAGE_ACCESS_VIOLATION contract. The MSVC branch is unchanged (diff is +45/-0). Tests: x86_64-w64-mingw32-g++ -fsyntax-only and -c -O1 of both translation units pass (baseline: error: expected 'catch' before '__except' in both files). Linux native build unaffected (Windows-only shims; not in the portable subset). check_no_game_data.py PASS. No game files, no GPU. MSVC compile not available on this machine. AI-assisted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:34 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#940
No description provided.