SaveState: Reject implausible event counts, ids and CPU speed from a state

They came straight from the file: a CPU frequency of 0 divided by zero,
and counts or ids sized tables of up to tens of gigabytes, or tripped an
assert. A file like that now fails to load like any other broken state.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-19 20:17:47 +02:00
1 parent 79d340f4fe
commit eec6afaeca
2 files changed
+19 -1

No files matched your search

+2 -1
View File
@@ -497,7 +497,8 @@ void HLEDoState(PointerWrap &p) {
delete action;
}
mipsCallActions.clear();
if (actions < 0) {
// Each action takes at least its type id.
if (actions < 0 || (size_t)actions > p.Remaining() / sizeof(int)) {
p.SetError(p.ERROR_FAILURE);
return;
}