[vlc-commits] demux/ttml: fix style-attribute generation on merge

Filip Roséen git at videolan.org
Tue Sep 20 00:59:19 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Sep 19 23:53:37 2016 +0200| [5ed17f84f1015d737ac1e46413804c4f00a8d915] | committer: Hugo Beauzée-Luyssen

demux/ttml: fix style-attribute generation on merge

If MergeStyles was invoked with *pp_dest == NULL, the resulting string
would contain unspecified/undefined data (given that passing NULL as
value for the corresponding format-specifier is undefined-behavior).

Most platforms will either print "" or "(null)" for such cases, and
the latter will cause problems with the decoder.

These changes fixes the issue by explicitly printing an empty string
if "*pp_dest == NULL".

fixes #17414

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/demux/ttml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index f060d94..e100826 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -254,7 +254,7 @@ static int MergeStyles(char** pp_dest, char* p_src)
     if( p_src )
     {
         char *p_tmp = NULL;
-        if( asprintf( &p_tmp, "%s %s", p_src, *pp_dest ) < 0 )
+        if( asprintf( &p_tmp, "%s %s", p_src, *pp_dest ? *pp_dest : "" ) < 0 )
             return VLC_ENOMEM;
 
         free( *pp_dest );



More information about the vlc-commits mailing list