[vlc-commits] Smem: don't divide by 0

Jean-Baptiste Kempf git at videolan.org
Fri Aug 26 00:19:34 CEST 2011


vlc/vlc-1.1 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Aug 22 15:27:59 2011 +0200| [852d47d8c4eb90273e0e770839c360b23a7a7bbb] | committer: Jean-Baptiste Kempf

Smem: don't divide by 0

Fix #4479
See https://bugs.kde.org/show_bug.cgi?id=279973
(cherry picked from commit 9285476128051fd0b5ae2983d619289d110b12eb)

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

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

 modules/stream_out/smem.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/modules/stream_out/smem.c b/modules/stream_out/smem.c
index 784c31b..59f27cf 100644
--- a/modules/stream_out/smem.c
+++ b/modules/stream_out/smem.c
@@ -369,6 +369,13 @@ static int SendAudio( sout_stream_t *p_stream, sout_stream_id_t *id,
     int i_samples = 0;
 
     i_size = p_buffer->i_buffer;
+    if (id->format->audio.i_channels <= 0)
+    {
+        msg_Warn( p_stream, "No buffer given!" );
+        block_ChainRelease( p_buffer );
+        return VLC_EGENERIC;
+    }
+
     i_samples = i_size / ( ( id->format->audio.i_bitspersample / 8 ) * id->format->audio.i_channels );
     /* Calling the prerender callback to get user buffer */
     p_sys->pf_audio_prerender_callback( id->p_data, &p_pcm_buffer, i_size );



More information about the vlc-commits mailing list