mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
IndexGenerator: Add assertion for overflow in GetRemainingIndices
This assertion is currently triggered by Pocoyo Racing (https://bugs.dolphin-emu.org/issues/13136).
This commit is contained in:
@ -334,6 +334,15 @@ u32 IndexGenerator::GetRemainingIndices(OpcodeDecoder::Primitive primitive) cons
|
|||||||
max_index >>= 2;
|
max_index >>= 2;
|
||||||
|
|
||||||
// -1 is reserved for primitive restart
|
// -1 is reserved for primitive restart
|
||||||
|
max_index = max_index - 1;
|
||||||
|
|
||||||
return max_index - m_base_index - 1;
|
if (m_base_index > max_index) [[unlikely]]
|
||||||
|
{
|
||||||
|
PanicAlertFmt("GetRemainingIndices would overflow; we've already written too many indices? "
|
||||||
|
"base index {} > max index {}",
|
||||||
|
m_base_index, max_index);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return max_index - m_base_index;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user