[vlc-commits] freetype: fixed crash within ATS when looking for non-existing font families
Felix Paul Kühne
git at videolan.org
Tue May 29 19:34:46 CEST 2012
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue May 29 19:34:16 2012 +0200| [6938a98a430431a7d8f41228c60dd883b8264e6a] | committer: Felix Paul Kühne
freetype: fixed crash within ATS when looking for non-existing font families
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6938a98a430431a7d8f41228c60dd883b8264e6a
---
modules/text_renderer/freetype.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index 0152d8e..19e2baa 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -722,14 +722,15 @@ static char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
*i_idx = 0;
msg_Dbg( p_filter, "looking for %s", psz_fontname );
- cf_fontName = CFStringCreateWithCString( NULL, psz_fontname, kCFStringEncodingUTF8 );
+ cf_fontName = CFStringCreateWithCString( kCFAllocatorDefault, psz_fontname, kCFStringEncodingUTF8 );
+
ats_font_id = ATSFontFindFromName( cf_fontName, kATSOptionFlagsIncludeDisabledMask );
CFRelease( cf_fontName );
- if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
+ if ( ats_font_id == 0xFFFFFFFFUL )
{
msg_Dbg( p_filter, "ATS couldn't find %s by name, checking family", psz_fontname );
- ats_font_id = ATSFontFamilyFindFromName( cf_fontName, kATSOptionFlagsIncludeDisabledMask );
+ ats_font_id = ATSFontFamilyFindFromName( cf_fontName, kATSOptionFlagsDefault );
if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
{
@@ -737,6 +738,11 @@ static char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
return NULL;
}
}
+ else if( ats_font_id == 0 )
+ {
+ msg_Err( p_filter, "ATS couldn't find %s by name, won't check family", psz_fontname );
+ return NULL;
+ }
if ( noErr != ATSFontGetFileReference( ats_font_id, &ref ) )
{
More information about the vlc-commits
mailing list