[vlc-devel] [PATCH] text_renderer/freetype: DumpDictionary: prevent potential null-dereference

Filip Roséen filip at atch.se
Thu May 18 12:19:27 CEST 2017


vlc_dictionary_all_keys may return NULL on error, rendering the
previous implemention prone to a potential null-pointer dereference.
---
 modules/text_renderer/freetype/platform_fonts.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/text_renderer/freetype/platform_fonts.c b/modules/text_renderer/freetype/platform_fonts.c
index 4ea648f77b..4491f6dce5 100644
--- a/modules/text_renderer/freetype/platform_fonts.c
+++ b/modules/text_renderer/freetype/platform_fonts.c
@@ -424,6 +424,10 @@ void DumpDictionary( filter_t *p_filter, const vlc_dictionary_t *p_dict,
                      bool b_dump_fonts, int i_max_families )
 {
     char **ppsz_keys = vlc_dictionary_all_keys( p_dict );
+
+    if( unlikely( !ppsz_keys ) )
+        return;
+
     for( int i = 0; ppsz_keys[ i ]; ++i )
     {
         vlc_family_t *p_family = vlc_dictionary_value_for_key( p_dict, ppsz_keys[ i ] );
-- 
2.12.2


More information about the vlc-devel mailing list