[MPlayer-cvslog] r24855 - trunk/libass/ass_font.c

eugeni subversion at mplayerhq.hu
Thu Oct 25 23:19:20 CEST 2007


Author: eugeni
Date: Thu Oct 25 23:19:20 2007
New Revision: 24855

Log:
Check return value of add_face.

This fixes segfault when reselecting fonts and the new font could not be
loaded (because of a bad font file, or too many font faces already loaded).
Patch by Glen Nakamura, glen at imodulo dot com.


Modified:
   trunk/libass/ass_font.c

Modified: trunk/libass/ass_font.c
==============================================================================
--- trunk/libass/ass_font.c	(original)
+++ trunk/libass/ass_font.c	Thu Oct 25 23:19:20 2007
@@ -294,12 +294,14 @@ FT_Glyph ass_font_get_glyph(void* fontco
 		mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_GlyphNotFoundReselectingFont,
 		       ch, font->desc.family, font->desc.bold, font->desc.italic);
 		face_idx = add_face(fontconfig_priv, font, ch);
+		if (face_idx >= 0) {
 		face = font->faces[face_idx];
 		index = FT_Get_Char_Index(face, ch);
 		if (index == 0) {
 			mp_msg(MSGT_ASS, MSGL_ERR, MSGTR_LIBASS_GlyphNotFound,
 			       ch, font->desc.family, font->desc.bold, font->desc.italic);
 		}
+		}
 	}
 #endif
 



More information about the MPlayer-cvslog mailing list