Commit 83e21b1d authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

demux: subtitle: fix divbyzero

can crash with start = -1 and stop = 0
parent 0d62f7c0
......@@ -564,12 +564,7 @@ static int Open ( vlc_object_t *p_this )
p_sys->subtitles.i_current = 0;
p_sys->i_length = 0;
if( p_sys->subtitles.i_count > 0 )
{
p_sys->i_length = p_sys->subtitles.p_array[p_sys->subtitles.i_count-1].i_stop;
/* +1 to avoid 0 */
if( p_sys->i_length <= 0 )
p_sys->i_length = p_sys->subtitles.p_array[p_sys->subtitles.i_count-1].i_start+1;
}
/* *** add subtitle ES *** */
if( p_sys->props.i_type == SUB_TYPE_SSA1 ||
......@@ -678,7 +673,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
*pf = 1.0;
}
else if( p_sys->subtitles.i_count > 0 )
else if( p_sys->subtitles.i_count > 0 && p_sys->i_length )
{
*pf = p_sys->i_next_demux_date - var_GetInteger( p_demux->obj.parent, "spu-delay" );
if( *pf < 0 )
......
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