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

Filip Roséen git at videolan.org
Thu May 18 21:08:34 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 12:19:27 2017 +0200| [b71eab28cea0ea754d1de05badfccfe5a4529ea7] | committer: Jean-Baptiste Kempf

text_renderer/freetype: DumpDictionary: prevent potential null-dereference

vlc_dictionary_all_keys may return NULL on error, rendering the
previous implemention prone to a potential null-pointer dereference.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b71eab28cea0ea754d1de05badfccfe5a4529ea7
---

 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 ] );



More information about the vlc-commits mailing list