[vlc-devel] [PATCH] mpeg-ts: fix comparing unsigned and signed integers

Rémi Denis-Courmont remi at remlab.net
Fri Dec 11 14:42:36 CET 2015


Le 2015-12-11 14:54, Petri Hintukainen a écrit :
> ---
>  modules/demux/mpeg/ts.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
> index 5e178d1..549303c 100644
> --- a/modules/demux/mpeg/ts.c
> +++ b/modules/demux/mpeg/ts.c
> @@ -2514,7 +2514,8 @@ static block_t* ReadTSPacket( demux_t *p_demux 
> )
>      /* Get a new TS packet */
>      if( !( p_pkt = stream_Block( p_sys->stream, p_sys->i_packet_size 
> ) ) )
>      {
> -        if( stream_Tell( p_sys->stream ) == stream_Size( 
> p_sys->stream ) )
> +        int64_t size = stream_Size( p_sys->stream );
> +        if( size >= 0 && (uint64_t)size == stream_Tell( 
> p_sys->stream ) )

The logic is wrong either way, as the stream size can be unknown.

>              msg_Dbg( p_demux, "EOF at %"PRId64, stream_Tell(
> p_sys->stream ) );
>          else
>              msg_Dbg( p_demux, "Can't read TS packet at %"PRId64,
> stream_Tell(p_sys->stream) );

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list