UBFIX: sprite.c (#1442)
Fix out-of-bounds array access in `SortSprites()`. Co-authored-by: Marcus Huderle <huderlem@gmail.com>
This commit is contained in:
+5
-2
@@ -452,6 +452,10 @@ void SortSprites(void)
|
|||||||
// Although this doesn't result in a bug in the ROM,
|
// Although this doesn't result in a bug in the ROM,
|
||||||
// the behavior is undefined.
|
// the behavior is undefined.
|
||||||
j--;
|
j--;
|
||||||
|
#ifdef UBFIX
|
||||||
|
if (j == 0)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
sprite1 = &gSprites[sSpriteOrder[j - 1]];
|
sprite1 = &gSprites[sSpriteOrder[j - 1]];
|
||||||
sprite2 = &gSprites[sSpriteOrder[j]];
|
sprite2 = &gSprites[sSpriteOrder[j]];
|
||||||
@@ -661,8 +665,7 @@ void ResetOamRange(u8 a, u8 b)
|
|||||||
|
|
||||||
for (i = a; i < b; i++)
|
for (i = a; i < b; i++)
|
||||||
{
|
{
|
||||||
struct OamData *oamBuffer = gMain.oamBuffer;
|
gMain.oamBuffer[i] = *(struct OamData *)&gDummyOamData;
|
||||||
oamBuffer[i] = *(struct OamData *)&gDummyOamData;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user