[vlc-commits] demux: avi: check chunk size

Francois Cartegnie git at videolan.org
Thu Jul 20 18:52:51 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jul 20 17:42:55 2017 +0200| [ee38d7ab4a230e12e154830c51aa227b7e0590a7] | committer: Francois Cartegnie

demux: avi: check chunk size

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

 modules/demux/avi/libavi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index 549aa36878..59ea0e44d4 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -31,6 +31,8 @@
 
 #include "libavi.h"
 
+#include <limits.h>
+
 #ifndef NDEBUG
 # define AVI_DEBUG 1
 #endif
@@ -60,6 +62,9 @@ static int AVI_ChunkReadCommon( stream_t *s, avi_chunk_t *p_chk )
     p_chk->common.i_chunk_size   = GetDWLE( p_peek + 4 );
     p_chk->common.i_chunk_pos    = vlc_stream_Tell( s );
 
+    if( UINT64_MAX - p_chk->common.i_chunk_pos < p_chk->common.i_chunk_size )
+        return VLC_EGENERIC;
+
     p_chk->common.p_father = NULL;
     p_chk->common.p_next = NULL;
     p_chk->common.p_first = NULL;



More information about the vlc-commits mailing list