mirror of https://github.com/zeldaret/oot.git
Merge 74a415a643
into 4c2a451b9c
This commit is contained in:
commit
a0af52f4c3
|
@ -141,6 +141,13 @@ void Graph_InitTHGA(GraphicsContext* gfxCtx) {
|
||||||
gfxCtx->overlayBuffer = pool->overlayBuffer;
|
gfxCtx->overlayBuffer = pool->overlayBuffer;
|
||||||
gfxCtx->workBuffer = pool->workBuffer;
|
gfxCtx->workBuffer = pool->workBuffer;
|
||||||
|
|
||||||
|
//! @bug fbIdx is a signed integer that can overflow into the negatives. When compiled with a C99+ compiler or IDO,
|
||||||
|
//! the remainder operator will yield -1 for odd negative values of fbIdx.
|
||||||
|
//! This results in an out of bounds array access in SysCfb_GetFbPtr due to the negative index value,
|
||||||
|
//! which will crash the game.
|
||||||
|
//!
|
||||||
|
//! In practice, this isn't an issue. In the worst case scenario with the game operating at a consistent 60 FPS,
|
||||||
|
//! it would take approximately 414.25 days of continuous operation for fbIdx to overflow.
|
||||||
gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->fbIdx % 2);
|
gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->fbIdx % 2);
|
||||||
gfxCtx->unk_014 = 0;
|
gfxCtx->unk_014 = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue