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

Petri Hintukainen phintuka at gmail.com
Fri Dec 11 13:54:23 CET 2015


---
 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 ) )
             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) );
-- 
2.5.0



More information about the vlc-devel mailing list