[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:33 CEST 2012


vlc/vlc-2.0 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Apr  2 05:16:00 2012 +0200| [e0bfcce8d2114fdb863408b4971a2adca2c4447b] | 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-2.0.git/?a=commit;h=e0bfcce8d2114fdb863408b4971a2adca2c4447b
---

 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