]> git.sesse.net Git - vlc/commitdiff
fix #1421
authorRafaël Carré <funman@videolan.org>
Sun, 30 Dec 2007 20:14:31 +0000 (20:14 +0000)
committerRafaël Carré <funman@videolan.org>
Sun, 30 Dec 2007 20:14:31 +0000 (20:14 +0000)
modules/demux/playlist/xspf.c

index 101bd729b25fff3d9363d5e547405639bc68f602..4b9c2b6994f67112f5eaa1e80431f6a5f10203d4 100644 (file)
@@ -125,9 +125,7 @@ int Demux( demux_t *p_demux )
     {
         input_item_t *p_new_input = p_demux->p_sys->pp_tracklist[i];
         if( p_new_input )
-        {
             input_ItemAddSubItem( p_current_input, p_new_input, VLC_FALSE );
-        }
         vlc_gc_decref( p_new_input );
     }
 
@@ -490,13 +488,9 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
                 if( !strcmp( psz_name, psz_element ) )
                 {
                     FREE_ATT();
-                    if( p_demux->p_sys->i_identifier <
+                    if( p_demux->p_sys->i_identifier == -1 ||
+                        p_demux->p_sys->i_identifier ==
                         p_demux->p_sys->i_tracklist_entries )
-                    {
-                        p_demux->p_sys->pp_tracklist[
-                            p_demux->p_sys->i_identifier ] = p_new_input;
-                    }
-                    else
                     {
                         if( p_demux->p_sys->i_identifier >
                             p_demux->p_sys->i_tracklist_entries )
@@ -508,6 +502,13 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
                                      p_demux->p_sys->i_tracklist_entries,
                                      p_demux->p_sys->i_tracklist_entries,
                                      p_new_input );
+                        p_demux->p_sys->i_identifier = -1; 
+                    }
+                    else
+                    {
+                        msg_Err( p_demux, "Invalid identifier %d", p_demux->p_sys->i_identifier );
+                        p_demux->p_sys->i_identifier = -1;
+                        return VLC_FALSE;
                     }
                     return VLC_TRUE;
                 }
@@ -578,7 +579,8 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
                         return VLC_FALSE;
                     }
                 }
-                else if( !strcmp( p_handler->name, "identifier" ) )
+                else if( !strcmp( p_handler->name, "identifier" ) && 
+                        *psz_value >= '0' && *psz_value <= '9' )
                 {
                     p_demux->p_sys->i_identifier = atoi( psz_value );
                 }