]> granicus.if.org Git - libass/commitdiff
Check for table availability when striking a glyph
authorGrigori Goronzy <greg@blackbox>
Sun, 19 Jul 2009 22:25:27 +0000 (00:25 +0200)
committerGrigori Goronzy <greg@blackbox>
Sun, 19 Jul 2009 22:25:27 +0000 (00:25 +0200)
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

index 8a93a4e7e38dd171d19fd38d28de6c035beeed36..9518b705eed3e9e1e69bd53af15fa59e1ff1c3fc 100644 (file)
@@ -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);