[vlc-commits] mpeg: fix integer overflow

Rémi Denis-Courmont git at videolan.org
Wed Jul 22 16:09:10 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 22 17:07:41 2020 +0300| [7c30007ae4385d707c8d395ac6d917c6dd69caee] | committer: Rémi Denis-Courmont

mpeg: fix integer overflow

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7c30007ae4385d707c8d395ac6d917c6dd69caee
---

 modules/demux/mpeg/es.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index f32d741043..2371ddbde3 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -817,8 +817,9 @@ static int GenericProbe( demux_t *p_demux, uint64_t *pi_offset,
      * We will accept probing 0.5s of data in this case.
      */
     const size_t i_probe = i_skip + i_check_size + i_base_probing + ( b_wav ? i_wav_extra_probing : 0);
-    const size_t i_peek = vlc_stream_Peek( p_demux->s, &p_peek, i_probe );
-    if( i_peek < i_skip + i_check_size )
+    const ssize_t i_peek = vlc_stream_Peek( p_demux->s, &p_peek, i_probe );
+
+    if( i_peek < 0 || (size_t)i_peek < i_skip + i_check_size )
     {
         msg_Dbg( p_demux, "cannot peek" );
         return VLC_EGENERIC;



More information about the vlc-commits mailing list