fix: crash on out-of-bound access when loading cheats#718
Merged
frysee merged 3 commits intoMay 12, 2026
Conversation
frysee
reviewed
May 12, 2026
d84e8f6 to
1d8a592
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I ran into a crash when running a debug build on the device with picodrive core. The crash is caused by populating a fixed size array without proper size check.
On game load,
Cheat_getPaths()creates a list of paths to try to load cheats from. 5 entries are pre-configured, and the rest are dynamically populated using the extensions supported by the emulator core. The issue is that some predefined paths (like glob) are added to the list without proper checks after the core extensions are processed, and that causes writing outside of array memory.Note that Picodrive core has 16 extensions supported, but there are upstream retroarch cores that support up to 42 extensions.
Change
Cheat_getPaths():OptionCheats_openMenu():i(passed in as a position parameter) to access cheat by indexjbut indexed bothcheatcodes.cheatsandOptionCheats_menu.itemswithiTest plan