[vlc-commits] subsdec: Fix potential use of uninitialized value

Hugo Beauzée-Luyssen git at videolan.org
Fri Apr 7 11:57:28 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Apr  7 11:06:01 2017 +0200| [4e0bc74dcb26ed7c1bf665678f3f275483acc553] | committer: Hugo Beauzée-Luyssen

subsdec: Fix potential use of uninitialized value

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

 modules/codec/subsdec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index fc0ad25..d48b2ce 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -489,6 +489,7 @@ static char* ConsumeAttribute( const char** ppsz_subtitle, char** psz_attribute_
 {
     const char* psz_subtitle = *ppsz_subtitle;
     char* psz_attribute_name;
+    *psz_attribute_value = NULL;
 
     while (*psz_subtitle == ' ')
         psz_subtitle++;
@@ -778,6 +779,11 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
 
                     while( ( psz_attribute_name = ConsumeAttribute( &psz_subtitle, &psz_attribute_value ) ) )
                     {
+                        if ( !psz_attribute_value )
+                        {
+                            free( psz_attribute_name );
+                            continue;
+                        }
                         if ( !strcasecmp( psz_attribute_name, "face" ) )
                         {
                             p_segment->style->psz_fontname = psz_attribute_value;



More information about the vlc-commits mailing list