[vlc-devel] [PATCH 02/11] demux: wav: refactor chunk skip

Rémi Denis-Courmont remi at remlab.net
Fri Mar 13 17:08:00 CET 2020


Le perjantaina 13. maaliskuuta 2020, 17.53.06 EET Thomas Guillem a écrit :
> Here is what I propose:
> 
> static int ChunkSkip( demux_t *p_demux, uint32_t i_size )
> {
>     i_size += i_size & 1;
> 
>     if( i_size >= 65536 )
>         return vlc_stream_Seek( p_demux->s,
>                                 vlc_stream_Tell( p_demux->s ) + i_size );
> 
>     ssize_t i_ret = vlc_stream_Read( p_demux->s, NULL, i_size );
>     return i_ret < 0 || (size_t) i_ret != i_size ? VLC_EGENERIC :
> VLC_SUCCESS; }

Off-by-one overflow if i_size is SIZE_MAX.

And there's no point optimizing the seek away if you can't play non-seekable 
inputs.

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list