[vlc-commits] quartztext: add missing sanity checks

Felix Paul Kühne git at videolan.org
Wed Jul 22 17:29:18 CEST 2015


vlc/vlc-2.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Jul 22 17:26:37 2015 +0200| [82912dec5426deeafa5a4436574e757a7b211582] | committer: Felix Paul Kühne

quartztext: add missing sanity checks

(cherry picked from commit 1a923e14fb27a79b139dd4f838ba997b6383b982)

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

 modules/text_renderer/quartztext.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/text_renderer/quartztext.c b/modules/text_renderer/quartztext.c
index 8de1081..3e75a08 100644
--- a/modules/text_renderer/quartztext.c
+++ b/modules/text_renderer/quartztext.c
@@ -470,7 +470,8 @@ static int HandleFontAttributes(xml_reader_t *p_xml_reader,
                                 &psz_fontname,
                                 &i_font_size,
                                 &i_font_color)) {
-        psz_fontname = strdup(psz_fontname);
+        if (psz_fontname)
+            psz_fontname = strdup(psz_fontname);
         i_font_size = i_font_size;
     }
     i_font_alpha = (i_font_color >> 24) & 0xff;
@@ -479,7 +480,8 @@ static int HandleFontAttributes(xml_reader_t *p_xml_reader,
     while ((attr = xml_ReaderNextAttr(p_xml_reader, &value))) {
         if (!strcasecmp("face", attr)) {
             free(psz_fontname);
-            psz_fontname = strdup(value);
+            if (value)
+                psz_fontname = strdup(value);
         } else if (!strcasecmp("size", attr)) {
             if ((*value == '+') || (*value == '-')) {
                 int i_value = atoi(value);
@@ -707,6 +709,8 @@ static int ProcessNodes(filter_t *p_filter,
                 int           len;
 
                 // Turn any multiple-whitespaces into single spaces
+                if (!node)
+                    break;
                 char *dup = strdup(node);
                 if (!dup)
                     break;
@@ -852,7 +856,7 @@ static CGContextRef CreateOffScreenContext(int i_width, int i_height,
                                 *pp_colorSpace, kCGImageAlphaPremultipliedFirst);
 
         if (p_context) {
-            if (CGContextSetAllowsAntialiasing != NULL)
+            if (&CGContextSetAllowsAntialiasing != NULL)
                 CGContextSetAllowsAntialiasing(p_context, true);
         }
         *pp_memory = p_bitmap;



More information about the vlc-commits mailing list