[vlc-commits] VOC: avoid division by 0 if number of channel is 0

Jean-Baptiste Kempf git at videolan.org
Mon Apr 2 06:21:43 CEST 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Apr  2 05:16:00 2012 +0200| [83db4181230ae3a0dbb3e7b64313988fd8cc31e5] | committer: Jean-Baptiste Kempf

VOC: avoid division by 0 if number of channel is 0

Reported by Marcin 'Icewall' Noga from Hispasec

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

 modules/demux/voc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/modules/demux/voc.c b/modules/demux/voc.c
index 877b655..5947bd1 100644
--- a/modules/demux/voc.c
+++ b/modules/demux/voc.c
@@ -357,6 +357,12 @@ static int ReadBlockHeader( demux_t *p_demux )
                     return VLC_EGENERIC;
             }
 
+            if( new_fmt.audio.i_channels == 0 )
+            {
+                msg_Err( p_demux, "0 channels detected" );
+                return VLC_EGENERIC;
+            }
+
             new_fmt.audio.i_bytes_per_frame = new_fmt.audio.i_channels
                 * (new_fmt.audio.i_bitspersample / 8);
             new_fmt.audio.i_frame_length = 1;



More information about the vlc-commits mailing list