citro2d icon indicating copy to clipboard operation
citro2d copied to clipboard

Fix wordNum off by one when TextBuf entirely full

Open LiquidFenrir opened this issue 3 years ago • 0 comments

When the last word of a text is longer than the remaining capacity of the C2D_TextBuf, text->words == glyph->wordNo causing out of bounds access in the alloca'd arrays when drawing the glyphs of this word, resulting in crashes.

This PR ensures the words member of the C2D_Text has the correct value, even when the while loop exits from its condition (no remaining capacity) instead of the break on line end/string end.

LiquidFenrir avatar Jul 21 '22 16:07 LiquidFenrir