Commit 01fc8320 authored by Laurent Aimar's avatar Laurent Aimar Committed by Jean-Baptiste Kempf

Fixed potential NULL deference in dvdnav plugin.

(cherry picked from commit 51b80d6fc0d81d0d31984d408d104df604bf9794)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent b9148012
...@@ -1001,32 +1001,33 @@ static void DemuxTitles( demux_t *p_demux ) ...@@ -1001,32 +1001,33 @@ static void DemuxTitles( demux_t *p_demux )
{ {
int32_t i_chapters; int32_t i_chapters;
uint64_t i_title_length; uint64_t i_title_length;
uint64_t *p_chapters_time;
#if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS) #if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS)
uint64_t *p_chapters_time = NULL;
i_chapters = dvdnav_describe_title_chapters( p_sys->dvdnav, i, i_chapters = dvdnav_describe_title_chapters( p_sys->dvdnav, i,
&p_chapters_time, &p_chapters_time,
&i_title_length ); &i_title_length );
if( i_chapters < 1 ) if( i_chapters < 1 )
{
i_title_length = 0; i_title_length = 0;
p_chapters_time = NULL;
}
#else #else
if( dvdnav_get_number_of_parts( p_sys->dvdnav, i, &i_chapters ) != DVDNAV_STATUS_OK ) if( dvdnav_get_number_of_parts( p_sys->dvdnav, i, &i_chapters ) != DVDNAV_STATUS_OK )
i_chapters = 0; i_chapters = 0;
i_title_length = 0; i_title_length = 0;
p_chapters_time = NULL;
#endif #endif
t = vlc_input_title_New(); t = vlc_input_title_New();
t->i_length = i_title_length * 1000 / 90; t->i_length = i_title_length * 1000 / 90;
for( int j = 0; j < __MAX( i_chapters, 1 ); j++ ) for( int j = 0; j < __MAX( i_chapters, 1 ); j++ )
{ {
s = vlc_seekpoint_New(); s = vlc_seekpoint_New();
#if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS) if( p_chapters_time )
s->i_time_offset = p_chapters_time[j] * 1000 / 90; s->i_time_offset = p_chapters_time[j] * 1000 / 90;
#endif
TAB_APPEND( t->i_seekpoint, t->seekpoint, s ); TAB_APPEND( t->i_seekpoint, t->seekpoint, s );
} }
#if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS)
free( p_chapters_time ); free( p_chapters_time );
#endif
TAB_APPEND( p_sys->i_title, p_sys->title, t ); TAB_APPEND( p_sys->i_title, p_sys->title, t );
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment