[vlc-devel] commit: Fixed a potential division by 0 in mp4 demuxer. (Laurent Aimar )

git version control git at videolan.org
Thu Oct 16 19:53:11 CEST 2008


vlc | branch: 0.8.6-bugfix | Laurent Aimar <fenrir at videolan.org> | Thu Aug 28 13:07:32 2008 +0200| [79d2c23a08400fdcf4869f7e62eb0b24b8db0508] | committer: Rémi Denis-Courmont 

Fixed a potential division by 0 in mp4 demuxer.
(cherry picked from commit f259d0a2ac6d4162fdb5b78ac3fdac5acdac1363)

Signed-off-by: Rémi Denis-Courmont <rdenis at simphalempin.com>

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

 modules/demux/mp4/mp4.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 503f2bd..6e2410c 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1467,7 +1467,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
     /* some last initialisation */
     switch( p_track->fmt.i_cat )
     {
-    case( VIDEO_ES ):
+    case VIDEO_ES:
         p_track->fmt.video.i_width = p_sample->data.p_sample_vide->i_width;
         p_track->fmt.video.i_height = p_sample->data.p_sample_vide->i_height;
         p_track->fmt.video.i_bits_per_pixel =
@@ -1504,7 +1504,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
 
         break;
 
-    case( AUDIO_ES ):
+    case AUDIO_ES:
         p_track->fmt.audio.i_channels =
             p_sample->data.p_sample_soun->i_channelcount;
         p_track->fmt.audio.i_rate =
@@ -1514,6 +1514,13 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
                 p_sample->data.p_sample_soun->i_samplesize;
         p_track->fmt.audio.i_bitspersample =
             p_sample->data.p_sample_soun->i_samplesize;
+
+        if( p_track->i_sample_size != 0 &&
+            p_sample->data.p_sample_soun->i_qt_version == 1 && p_sample->data.p_sample_soun->i_sample_per_packet <= 0 )
+        {
+            msg_Err( p_demux, "Invalid sample per packet value for qt_version 1" );
+            return VLC_EGENERIC;
+        }
         break;
 
     default:




More information about the vlc-devel mailing list