diff options
| author | Tyrannys <80750971+Tyrannys@users.noreply.github.com> | 2026-11-27 19:40:07 -0600 |
|---|---|---|
| committer | Tyrannys <80750971+Tyrannys@users.noreply.github.com> | 2026-11-27 19:40:07 -0600 |
| commit | 9d054cd8557d96bdba0263e1ad6278bed60a3583 (patch) | |
| tree | ae1f4fcf9d8f59fc5a776bc704f51409c089b8ee /runtime/src/pe_loader.cpp | |
| parent | 431ceba4f4a55c69c26fcf0e36fd83e86e1b9a32 (diff) | |
Async callback and handle safety in xgameruntime, gameinput_no_sdl and xapu_queue
kevincommits' Finding 19 in #1608, item 5:
- xgameruntime.cpp (XNetworking): an initial notification's callback
that unregistered itself with wait=true waited for its own return and
never came back. The registration now records the thread running its
callback, and an unregister from that thread returns at once (the
registration ends when the callback returns). net_register also used a
throwing new across the ABI; it is new (std::nothrow) now.
- gameinput_no_sdl.cpp: a GameInputBlockingEnumeration report ran
outside deliver_mu, so UnregisterCallback on another thread returned
while the callback was still running and the caller could free its
context mid-call. It now runs under deliver_mu and marked as
delivering, as deliver() runs callbacks.
- xapu_queue.cpp: handles were never checked, so a second XApuDisconnect
freed the connection again and closed its event twice. Connections are
kept in a live set under a shared mutex; every call checks its handle
and holds the lock shared for the call, and a disconnect takes it
exclusive. An activate or deactivate changed the stream before the
result was queued, so running out of memory left it half applied; the
result's slot is now taken first.
New checks: xgameruntime_test (a callback that unregisters itself with
wait=true returns), gameinput_no_sdl_test (UnregisterCallback waits for a
running blocking callback; a blocking callback can unregister itself),
xapu_chad_test (a second disconnect, a disconnected and a foreign handle
are refused). On main the first two fail and xapu_chad_test crashes with
heap corruption.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/pe_loader.cpp')
0 files changed, 0 insertions, 0 deletions