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

VI: Prevent out-of-bounds access when clock register is a nonstandard value. #11874

Merged
merged 1 commit into from Jun 7, 2023

Conversation

AdmiralCurtiss
Copy link
Contributor

The emulated system has full access to this register so it could potentially write garbage in there. Garbage could also be loaded from a savestate.

YAGCD says only the lowest bit is used so that's what I've done here, but someone would have to actually test this on hardware to be sure.

@iwubcode
Copy link
Contributor

iwubcode commented Jun 2, 2023

Did you just notice this or did a particular issue happen that triggered this fix?

Not sure how this gets used, would assume fifoci probably already did due diligence but to be safe I'll throw some games at it.

@AdmiralCurtiss
Copy link
Contributor Author

I was debugging something (probably related to multiple threads calling PauseAndLock(), see that other PR) that caused the JIT to start executing on nonsense data, which happened to copy garbage to the VI data structs. Since I was in debug mode MSVC helpfully pointed out the out-of-bounds access here.

@lioncash lioncash merged commit bab3229 into dolphin-emu:master Jun 7, 2023
14 checks passed
@AdmiralCurtiss AdmiralCurtiss deleted the vi-clock-bounds branch June 7, 2023 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants