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

Jean-Baptiste Kempf git at videolan.org
Mon Apr 2 17:09:50 CEST 2012


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

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

Reported by Marcin 'Icewall' Noga from Hispasec
(cherry picked from commit 83db4181230ae3a0dbb3e7b64313988fd8cc31e5)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 2f0d683..4660257 100644
--- a/modules/demux/voc.c
+++ b/modules/demux/voc.c
@@ -360,6 +360,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