text-freetype2: Fix a crash if there's insufficient glyph texture space

This commit is contained in:
Richard Stanway
2016-04-24 20:21:07 +02:00
parent c2e4926323
commit 8f3289fc4d

View File

@@ -271,6 +271,11 @@ void cache_glyphs(struct ft2_source *srcdata, wchar_t *cache_glyphs)
dy += srcdata->max_h + 1;
}
if (dy + g_h >= texbuf_h) {
blog(LOG_WARNING, "Out of space trying to render glyphs");
break;
}
src_glyph = bzalloc(sizeof(struct glyph_info));
src_glyph->u = (float)dx / (float)texbuf_w;
src_glyph->u2 = (float)(dx + g_w) / (float)texbuf_w;