[vlc-commits] demux: mp4: fix buffer overflow in parsing of string boxes.

Fabian Yamaguchi git at videolan.org
Thu Jan 22 14:34:06 CET 2015


vlc/vlc-2.1 | branch: master | Fabian Yamaguchi <fyamagu at gwdg.de> | Fri Dec  5 13:52:42 2014 +0100| [8eab5c92136ffc60873c41c06e7a6a9266e8af7c] | committer: Jean-Baptiste Kempf

demux: mp4: fix buffer overflow in parsing of string boxes.

We ensure that pbox->i_size is never smaller than 8 to avoid an
integer underflow in the third argument of the subsequent call to
memcpy. We also make sure no truncation occurs when passing values
derived from the 64 bit integer p_box->i_size to arguments of malloc
and memcpy that may be 32 bit integers on 32 bit platforms.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 2e7c7091a61aa5d07e7997b393d821e91f593c39)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

Conflicts:
	modules/demux/mp4/libmp4.c

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

 modules/demux/mp4/libmp4.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 3abb940..ba6dcb9 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2596,6 +2596,9 @@ static int MP4_ReadBox_name( stream_t *p_stream, MP4_Box_t *p_box )
 {
     MP4_READBOX_ENTER( MP4_Box_data_name_t );
 
+    if( p_box->i_size < 8 || p_box->i_size > SIZE_MAX )
+        MP4_READBOX_EXIT( 0 );
+
     p_box->data.p_name->psz_text = malloc( p_box->i_size + 1 - 8 ); /* +\0, -name, -size */
     if( p_box->data.p_name->psz_text == NULL )
         MP4_READBOX_EXIT( 0 );



More information about the vlc-commits mailing list