[vlc-commits] demux: mp4: fix off by one write in channels handling (cid #1251054)

Francois Cartegnie git at videolan.org
Fri Jan 1 18:17:55 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jan  1 17:10:53 2016 +0100| [a9c4efde9589e7bda19afeb0462a7382ad791589] | committer: Francois Cartegnie

demux: mp4: fix off by one write in channels handling (cid #1251054)

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

 modules/demux/mp4/essetup.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index a3dd7f5..501f22a 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -730,9 +730,8 @@ int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
             {
                 if ( chan_bitmap_mapping[i].i_bitmap & i_bitmap )
                 {
-                    i_channels++;
                     if ( (chan_bitmap_mapping[i].i_vlc & i_vlc_mapping) ||
-                         i_channels > AOUT_CHAN_MAX )
+                         i_channels >= AOUT_CHAN_MAX )
                     {
                         /* double mapping or unsupported number of channels */
                         i_vlc_mapping = 0;
@@ -740,8 +739,9 @@ int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
                         break;
                     }
                     i_vlc_mapping |= chan_bitmap_mapping[i].i_vlc;
-                    rgi_chans_sequence[i_channels - 1] = chan_bitmap_mapping[i].i_vlc;
+                    rgi_chans_sequence[i_channels] = chan_bitmap_mapping[i].i_vlc;
                 }
+                i_channels++;
             }
             rgi_chans_sequence[i_channels] = 0;
             p_track->b_chans_reorder = !!



More information about the vlc-commits mailing list