[vlc-devel] [vlc-commits] codec: subsvtt: unbreak rendering (fix #22425)

Rémi Denis-Courmont remi at remlab.net
Fri Jun 14 15:31:45 CEST 2019


Le vendredi 14 juin 2019, 11:28:42 EEST Francois Cartegnie a écrit :
> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jun 14
> 10:27:31 2019 +0200| [749b7b3729a5892d1a07036ef0974c17ddbe9e2e] |
> committer: Francois Cartegnie
> 
> codec: subsvtt: unbreak rendering (fix #22425)
> 
> 5ef3830f385bfa6a47e9088f9a0d13062cd61c3a regression
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=749b7b3729a5892d1a0
> > 7036ef0974c17ddbe9e2e
> ---
> 
>  modules/codec/webvtt/subsvtt.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/modules/codec/webvtt/subsvtt.c b/modules/codec/webvtt/subsvtt.c
> index f9b686ebda..8e18edefab 100644
> --- a/modules/codec/webvtt/subsvtt.c
> +++ b/modules/codec/webvtt/subsvtt.c
> @@ -1857,11 +1857,7 @@ static void Render( decoder_t *p_dec, vlc_tick_t
> i_start, vlc_tick_t i_stop )
> 
>      GetTimedTags( p_sys->p_root->p_child, i_start, i_stop, &timedtags );
>      if( timedtags.i_count == 0 )
> -    {
> -        vlc_array_clear( &timedtags );
> -        return;
> -    }
> -    qsort( timedtags.pp_elems, timedtags.i_count,
> sizeof(*timedtags.pp_elems), timedtagsArrayCmp );
> +        qsort(
> timedtags.pp_elems, timedtags.i_count, sizeof(*timedtags.pp_elems),
> timedtagsArrayCmp );

This is obviously completely nonsensical. Literally, if i_count is zero, it's 
UB, qsort(NULL). That is blatantly obvious if you just read the description of 
the cited 5ef3830 Hugo's changeset. Meanwhile if i_count is non-zero it does 
not sort anymore, making the sort() call useless.

I really don't think it's appropriate to push this in 1 minute and then 
backport to LTS another 2 minutes without even proof-reading the code.

-- 
Rémi Denis-Courmont




More information about the vlc-devel mailing list