From 708d5c36dafcf8cc1f36fc8d35d25fa7f2a337e5 Mon Sep 17 00:00:00 2001 From: Christoph Scholtes Date: Mon, 12 Feb 2018 18:14:39 -0700 Subject: [PATCH] Fix segfault when number of rows is equal to or exceeds BND_MAX_ROWS. --- blendish.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blendish.h b/blendish.h index 30bc3cb..c9a97d4 100644 --- a/blendish.h +++ b/blendish.h @@ -2240,7 +2240,7 @@ static void bndCaretPosition(NVGcontext *ctx, float x, float y, int *cr, float *cx, float *cy) { static NVGglyphPosition glyphs[BND_MAX_GLYPHS]; int r,nglyphs; - for (r=0; r < nrows && rows[r].end < caret; ++r); + for (r=0; r < nrows-1 && rows[r].end < caret; ++r); *cr = r; *cx = x; *cy = y-lineHeight-desc + r*lineHeight;