[vlc-commits] Vobsub: language is not necessarily on 2 characters

Jean-Baptiste Kempf git at videolan.org
Wed Feb 23 20:45:57 CET 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Feb 23 20:26:10 2011 +0100| [a76a1d046ad221c6ac7132a064e25e5393d6ef98] | committer: Jean-Baptiste Kempf

Vobsub: language is not necessarily on 2 characters

This fixes quite a few .idx samples that didn't work before.

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

 modules/demux/vobsub.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index e999096..38b2871 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -519,25 +519,25 @@ static int ParseVobSubIDX( demux_t *p_demux )
         }
         else if( !strncmp( "id:", line, 3 ) )
         {
-            char language[3];
+            char language[33]; /* Usually 2 or 3 letters, sometimes more.
+                                  Spec (or lack of) doesn't define any limit */
             int i_track_id;
             es_format_t fmt;
 
             /* Lets start a new track */
-            if( sscanf( line, "id: %2s, index: %d",
+            if( sscanf( line, "id: %32[^ ,], index: %d",
                         language, &i_track_id ) == 2 )
             {
                 p_sys->i_tracks++;
                 p_sys->track = xrealloc( p_sys->track,
                           sizeof( vobsub_track_t ) * (p_sys->i_tracks + 1 ) );
-                language[2] = '\0';
 
                 /* Init the track */
                 current_tk = &p_sys->track[p_sys->i_tracks - 1];
                 memset( current_tk, 0, sizeof( vobsub_track_t ) );
                 current_tk->i_current_subtitle = 0;
                 current_tk->i_subtitles = 0;
-                current_tk->p_subtitles = xmalloc( sizeof( subtitle_t ) );;
+                current_tk->p_subtitles = xmalloc( sizeof( subtitle_t ) );
                 current_tk->i_track_id = i_track_id;
                 current_tk->i_delay = (int64_t)0;
 



More information about the vlc-commits mailing list