[vlc-commits] mad: robustify against corrupt byte streams (fixes #10726)

Rémi Denis-Courmont git at videolan.org
Thu Mar 20 21:13:56 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Mar 20 22:13:23 2014 +0200| [9cd0bbb7e80d34ba0c0f7e1c337243678bce45b1] | committer: Rémi Denis-Courmont

mad: robustify against corrupt byte streams (fixes #10726)

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

 modules/audio_filter/converter/mpgatofixed32.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/audio_filter/converter/mpgatofixed32.c b/modules/audio_filter/converter/mpgatofixed32.c
index 261420a..b517952 100644
--- a/modules/audio_filter/converter/mpgatofixed32.c
+++ b/modules/audio_filter/converter/mpgatofixed32.c
@@ -103,6 +103,7 @@ static void DoWork( filter_t * p_filter,
 
     if( p_sys->i_reject_count > 0 )
     {
+reject:
         memset( p_out_buf->p_buffer, 0, p_out_buf->i_buffer );
         p_sys->i_reject_count--;
         return;
@@ -117,7 +118,14 @@ static void DoWork( filter_t * p_filter,
     mad_fixed_t const * p_right = p_pcm->samples[1];
     float *p_samples = (float *)p_out_buf->p_buffer;
 
-    assert( i_samples == p_out_buf->i_nb_samples );
+    if( i_samples != p_out_buf->i_nb_samples )
+    {
+        msg_Err( p_filter, "unexpected samples count (corrupt stream?): "
+                 "%u / %u", i_samples, p_out_buf->i_nb_samples );
+        p_sys->i_reject_count = 3;
+        goto reject;
+    }
+
     /* Interleave and keep buffers in mad_fixed_t format */
     if ( p_pcm->channels == 2 )
     {



More information about the vlc-commits mailing list