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

git version control git at videolan.org
Thu Aug 28 13:05:36 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Aug 28 13:07:32 2008 +0200| [f259d0a2ac6d4162fdb5b78ac3fdac5acdac1363] | committer: Laurent Aimar 

Fixed a potential division by 0 in mp4 demuxer.

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

 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 d84f4f0..ebe914d 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1714,7 +1714,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 =
@@ -1751,7 +1751,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 =
@@ -1761,6 +1761,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