[MPlayer-dev-eng] [PATCH] Check add_face return value in ass_font.c (libass)

Glen Nakamura glen at imodulo.com
Thu Oct 25 13:11:39 CEST 2007


The attached patch fixes a segmentation fault when add_face returns -1.
I left out the indentation fixes in accordance with the FAQ.

- glen
-------------- next part --------------
Index: libass/ass_font.c
===================================================================
--- libass/ass_font.c	(revision 24847)
+++ libass/ass_font.c	(working copy)
@@ -294,12 +294,14 @@
 		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-dev-eng mailing list