[vlc-devel] commit: Protect against unsupported/invalid wav speaker mask. ( Laurent Aimar )

git version control git at videolan.org
Fri Apr 3 00:10:52 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Apr  3 00:10:14 2009 +0200| [730eefea2a9958d494694eaab6dbd47dd010bc6b] | committer: Laurent Aimar 

Protect against unsupported/invalid wav speaker mask.

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

 modules/demux/wav.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index e411644..63e4204 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -123,7 +123,7 @@ static int Open( vlc_object_t * p_this )
         return VLC_ENOMEM;
 
     p_sys->p_es         = NULL;
-    p_sys->b_chan_reorder = 0;
+    p_sys->b_chan_reorder = false;
     p_sys->i_channel_mask = 0;
 
     /* skip riff header */
@@ -197,10 +197,20 @@ static int Open( vlc_object_t * p_this )
         i_channel_mask = GetDWLE( &p_wf_ext->dwChannelMask );
         if( i_channel_mask )
         {
+            int i_match = 0;
             for( i = 0; i < sizeof(pi_channels_src)/sizeof(uint32_t); i++ )
             {
                 if( i_channel_mask & pi_channels_src[i] )
+                {
+                    if( !( p_sys->i_channel_mask & pi_channels_in[i] ) )
+                        i_match++;
                     p_sys->i_channel_mask |= pi_channels_in[i];
+                }
+            }
+            if( i_match != p_sys->fmt.audio.i_channels )
+            {
+                msg_Err( p_demux, "Invalid/unsupported channel mask" );
+                p_sys->i_channel_mask = 0;
             }
         }
     }




More information about the vlc-devel mailing list