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

Fabian Yamaguchi git at videolan.org
Mon Dec 8 13:15:04 CET 2014


vlc/vlc-2.2 | branch: master | Fabian Yamaguchi <fyamagu at gwdg.de> | Fri Dec  5 13:52:42 2014 +0100| [914462405f8e90d9b2b1184ff047fdfb1f800b48] | 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>

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

 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 19e84d3..3912e7e 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2667,6 +2667,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