[vlc-devel] [PATCH] freetype/platform_fonts: Do not strdup NULL

Marvin Scholz epirat07 at gmail.com
Sat Jun 17 14:43:45 CEST 2017


After re-reading some parts of the code, I am wondering if the darwin
implementation of pf_get_family (CoreText_GetFamily) is the problem 
here.

Is it valid to add a vlc_font_t with NULL for psz_fontfile to a 
vlc_family_t?
If not, this should be fixed in CoreText_GetFamily instead, I guess.


On 17 Jun 2017, at 14:05, Marvin Scholz wrote:

> ---
>  modules/text_renderer/freetype/platform_fonts.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/modules/text_renderer/freetype/platform_fonts.c 
> b/modules/text_renderer/freetype/platform_fonts.c
> index 4491f6dce5..2e6bfa431d 100644
> --- a/modules/text_renderer/freetype/platform_fonts.c
> +++ b/modules/text_renderer/freetype/platform_fonts.c
> @@ -572,8 +572,10 @@ char* Generic_Select( filter_t *p_filter, const 
> char* psz_family,
>      if( p_family && ( p_font = GetBestFont( p_filter, p_family, 
> b_bold,
>                                              b_italic, codepoint ) ) )
>      {
> -        *i_idx = p_font->i_index;
> -        return strdup( p_font->psz_fontfile );
> +        if (p_font->psz_fontfile) {
> +            *i_idx = p_font->i_index;
> +            return strdup( p_font->psz_fontfile );
> +        }
>      }
>
>      return File_Select( SYSTEM_DEFAULT_FONT_FILE );
> -- 
> 2.11.0 (Apple Git-81)


More information about the vlc-devel mailing list