From 2f74c6713dccee2b14b81a9c21731b83e181f31d Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Mon, 20 Jul 2009 00:25:27 +0200 Subject: Check for table availability when striking a glyph The glyph striker (underline/strike-through) did not check for table availability, possibly accessing a NULL pointer. Change this to only strike the glyph if the table with the appropriate information is available. Currently there is no fallback for fonts without the required information. --- libass/ass_font.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libass/ass_font.c') diff --git a/libass/ass_font.c b/libass/ass_font.c index 8a93a4e..9518b70 100644 --- a/libass/ass_font.c +++ b/libass/ass_font.c @@ -316,7 +316,7 @@ static int ass_strike_outline_glyph(FT_Face face, ass_font_t *font, y_scale = face->size->metrics.y_scale; // Add points to the outline - if (under) { + if (under && ps) { int pos, size; pos = FT_MulFix(ps->underlinePosition, y_scale * font->scale_y); size = FT_MulFix(ps->underlineThickness, @@ -339,7 +339,7 @@ static int ass_strike_outline_glyph(FT_Face face, ass_font_t *font, ol->contours[ol->n_contours++] = ol->n_points - 1; } - if (through) { + if (through && os2) { int pos, size; pos = FT_MulFix(os2->yStrikeoutPosition, y_scale * font->scale_y); size = FT_MulFix(os2->yStrikeoutSize, y_scale * font->scale_y / 2); -- cgit v1.2.3