[vlc-commits] subsdec: avoid segfaults

Rafaël Carré git at videolan.org
Mon Dec 31 14:15:12 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Dec 31 14:15:02 2012 +0100| [0560ceb34d73e080019d09c84ed7843e3cc375a1] | committer: Rafaël Carré

subsdec: avoid segfaults

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

 modules/codec/subsdec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index a6c2382..357fbf9 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -735,7 +735,7 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle )
             {
                 bool   b_match     = false;
                 bool   b_ignore    = false;
-                int    i_len       = strlen( psz_tag ) - 1;
+                int    i_len       = (psz_tag ? strlen(psz_tag) : 0) - 1;
                 char  *psz_lastTag = NULL;
 
                 if( i_len >= 0 )
@@ -954,7 +954,7 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle )
         }
     }
 
-    while( *psz_tag )
+    while( psz_tag && *psz_tag )
     {
         /* */
         char *psz_last = &psz_tag[strlen(psz_tag)-1];



More information about the vlc-commits mailing list