Fix out-of-bounds access in the bndCaretPosition->nvgTextGlyphPositions of the nanovg example. (#3650)

This commit is contained in:
Any
2026-04-03 00:12:57 +08:00
committed by GitHub
parent 9a1ce9c60b
commit fc29f359f3

View File

@@ -2248,7 +2248,7 @@ static void bndCaretPosition(NVGcontext *ctx, float x, float y,
if (nrows == 0) return;
*cx = rows[r].minx;
nglyphs = nvgTextGlyphPositions(
ctx, x, y, rows[r].start, rows[r].end+1, glyphs, BND_MAX_GLYPHS);
ctx, x, y, rows[r].start, rows[r].end, glyphs, BND_MAX_GLYPHS);
for (int i=0; i < nglyphs; ++i) {
*cx=glyphs[i].x;
if (glyphs[i].str == caret) break;