[pr-fix][input][startup] mousehook: nothing is read past the end of the title image #418
Loading…
Reference in a new issue
No description provided.
Delete branch "iboom72/mousehook-reads-inside-image"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What it changes
mousehook::install(crates/darner-hle/src/mousehook.rs:1815) reads the 1.0.2.1 prologue atbase + 0xe4e3d0for every title, before any setting is checked. If that doesn't match, it still goes on tohook_entryat the same address. With a title or build whose image is smaller than about 15 MB, those reads land past the image's end.What changes:
bytes()returns nothing past the image'sSizeOfImage. darner-hle already reads that from the mapped headers inruntime::image_size, whichset_main_imageuses; it is nowpub(crate).installstops before any hook when the prologue isn't the known build's. It logs the same "prologue … differs (another title/build?)" warning as before.With the known build nothing changes: the prologue matches and the same hooks are installed.
How it was tested
2520657d(onmainf3840d73)cargo test -p darner-hle --lib --locked mousehook: 9 passed, including the newbytes_reads_nothing_past_the_image.cargo clippy -p darner-hle --lib --locked -- -D warnings: clean.bytes_reads_nothing_past_the_imageuses a synthetic 0x100-byte image header.Checklist
main.docs/asset-policy.md.Checked for overlap
runtime::image_sizechange (pub(crate)) to bound its own DualSense hooks; the two merge cleanly in either order. #185 adds fixed-offset hooks bounded by the constantIMAGE_MAX. #399 editsmousehook.rs(the capture log). Each merges with this branch without a conflict (git merge-treeagainst their current heads).Checked with AI assistance (Claude Code).
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.