Skip to content

Fix native crash, race and corruption hazards - #55

Merged
MisterGatto merged 1 commit into
skyprotocol:osp-masterfrom
HugeFrog24:fix/native-findings
Oct 31, 2026
Merged

MisterGatto merged 1 commit into
skyprotocol:osp-masterfrom
HugeFrog24:fix/native-findings

Conversation

@HugeFrog24

Copy link
Copy Markdown
Contributor
# What goes wrong Needs a mod? How often Files
1 Overlay crashes or keeps rendering after the app is switched away No Timing-dependent androidbk.cpp
2 Icon drawn from a garbage texture reference No Rare IconLoader.cpp
3 Process abort after a file picker on a mod thread Yes Every time fileselector.cpp
4 Crash deleting a patch that never applied Yes Every time CipherPatch.cpp
5 Use-after-free reading device info Yes Long device names CipherUtils.cpp
6 Garbage written into game code Yes (or ChatFlagFix, later) Lowercase hex artpatch.c
7 Crash or lost execute permission when patching Yes Rare, then sticks artpatch.c, procutils.c
8 Keyboard listener use-after-free Yes Timing-dependent CipherUtils.cpp, main.cpp, Canvas.h, Canvas.cpp
9 Stack overflow in pattern scans Yes 255+ byte patterns CipherUtils.cpp

Reproduced, not guessed. Each finding has a sanitizer report (ASan, UBSan, TSan, MSan or libFuzzer) or a failing check.

No ABI changes. Existing mods keep working.

Overlay:
- Skip resurface when the Surface was already destroyed instead of
  dereferencing a NULL ANativeWindow.
- Make the render-loop run flag atomic and set it before surface setup,
  so a shutdown that arrives during resurface is no longer lost.

artpatch:
- Accept lowercase hex digits; they left the patch buffer uninitialised
  and wrote it into game code.
- Change protection on every page a patch spans, not only the first.
- Treat /proc/self/maps end addresses as exclusive.

Cipher:
- Bound patternToBytes to the callers' 256-byte buffers.
- Copy DeviceInfo member-wise instead of memcpy over std::string.
- Guard keyboard listener registration with a mutex and deliver from a
  copy of the list.
- Erase a CipherPatch from the instance list only when it is registered.

fileselector: detach threads that the file pickers attached.

IconLoader: return the error image for every unhandled KTX upload result.

No public header or exported signature changes; existing mods keep
working.
@MisterGatto
MisterGatto merged commit f47ad97 into skyprotocol:osp-master Oct 31, 2026
1 check failed
@HugeFrog24
HugeFrog24 deleted the fix/native-findings branch November 1, 2026 13:12
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.

2 participants