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

Jean-Baptiste Kempf git at videolan.org
Mon Aug 22 15:31:08 CEST 2011


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

Smem: don't divide by 0

Fix #4479
See https://bugs.kde.org/show_bug.cgi?id=279973

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

 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 615536b..5587c2f 100644
--- a/modules/stream_out/smem.c
+++ b/modules/stream_out/smem.c
@@ -392,6 +392,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