Merge pull request #1930 from KABoissonneault/fix/factory_oob
Fixed out-of-bounds access in GetFactoryMonFixedIV for BUGFIX
This commit is contained in:
@@ -741,8 +741,15 @@ u8 GetFactoryMonFixedIV(u8 challengeNum, bool8 isLastBattle)
|
||||
u8 ivSet;
|
||||
bool8 useHigherIV = isLastBattle ? TRUE : FALSE;
|
||||
|
||||
if (challengeNum > 8)
|
||||
ivSet = 7;
|
||||
// The Factory has an out-of-bounds access when generating the rental draft for round 9 (challengeNum==8),
|
||||
// or the "elevated" rentals from round 8 (challengeNum+1==8)
|
||||
// This happens to land on a number higher than 31, which is interpreted as "random IVs"
|
||||
#ifdef BUGFIX
|
||||
if (challengeNum >= ARRAY_COUNT(sFixedIVTable))
|
||||
#else
|
||||
if (challengeNum > ARRAY_COUNT(sFixedIVTable))
|
||||
#endif
|
||||
ivSet = ARRAY_COUNT(sFixedIVTable) - 1;
|
||||
else
|
||||
ivSet = challengeNum;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user