Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gb: invalid function pointer called on write to 0xFF50 #110

Closed
deltabeard opened this issue Jun 8, 2024 · 0 comments
Closed

gb: invalid function pointer called on write to 0xFF50 #110

deltabeard opened this issue Jun 8, 2024 · 0 comments
Assignees
Labels
bug Something isn't working diff: easy Easy difficulty.

Comments

@deltabeard
Copy link
Owner

It has been reported to me in private that it is possible for Peanut-GB to call NULL as a function if a spurious write to 0xFF50 happens. If gb_bootrom_read is not set by the frontend implementation, Peanut-GB could end up calling NULL as a function point when reading the first 0x100 bytes of ROM bank 0.

Thank you to the anonymous reporter.

@deltabeard deltabeard added bug Something isn't working diff: easy Easy difficulty. labels Jun 8, 2024
@deltabeard deltabeard self-assigned this Jun 8, 2024
deltabeard added a commit that referenced this issue Jun 13, 2024
Fixed issue #110 whereby a spurious write could enable the bootrom.
Previously, the bootrom could be enabled by writing 0 to 0xFF50. But
this is not possible on real hardware after the bootrom writes 1 to
0xFF50. No game is expected to attempt to re-enable the bootrom, but a
bug in a game or the emulator could cause it to happen.

If the bootrom was enabled by the game, and the gb_bootrom_read function
was set to NULL, then a NULL pointer exception was possible.

Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working diff: easy Easy difficulty.
Projects
None yet
Development

No branches or pull requests

1 participant