diff --git a/src/code/graph.c b/src/code/graph.c index 8a4646808f..63c2fdba91 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -141,6 +141,9 @@ void Graph_InitTHGA(GraphicsContext* gfxCtx) { gfxCtx->overlayBuffer = pool->overlayBuffer; gfxCtx->workBuffer = pool->workBuffer; + //! @bug fbIdx is a signed integer that can overflow into the negatives. When compiled with IDO, the remainder + //! operator will yield -1 for odd negative values of fbIdx (i.e. the same as C99 onwards). + //! This results in an out of bounds array access in SysCfb_GetFbPtr due to the negative index value. gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->fbIdx % 2); gfxCtx->unk_014 = 0; }