diff --git a/ttf.c b/ttf.c index ee8be77..fa02b1c 100644 --- a/ttf.c +++ b/ttf.c @@ -608,7 +608,7 @@ ttfGetExtents( } // Find its width... - if ((widths = font->widths[ch / 256]) != NULL) + if (ch < TTF_FONT_MAX_CHAR && (widths = font->widths[ch / 256]) != NULL) { if (first) {