[vlc-commits] demux: remove invalid filter pointer

Rémi Denis-Courmont git at videolan.org
Tue Sep 19 18:10:21 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Sep 19 19:05:44 2017 +0300| [e4a19c4138f4aff1103564074c069ba0fcbdc32a] | committer: Rémi Denis-Courmont

demux: remove invalid filter pointer

Accessing demux_t.p_next from outside the demux module violates
typing (pointer might be to stream_t), access (object is owned by
the demux filter) and threading rules (if demux filter were threaded,
though that´s currently theoretical).

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

 src/input/demux.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/input/demux.c b/src/input/demux.c
index 9aafc92791..838ebe8591 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -636,16 +636,13 @@ static bool demux_filter_enable_disable( demux_t *p_demux_chain,
                                           const char* psz_demux, bool b_enable )
 {
     demux_t *p_demux = p_demux_chain;
-    while ( p_demux )
-    {
-        if( strcmp( module_get_name( p_demux->p_module, false ), psz_demux) == 0 ||
-            strcmp( module_get_name( p_demux->p_module, true ), psz_demux ) == 0 )
-        {
-            demux_Control( p_demux,
-                           b_enable ? DEMUX_FILTER_ENABLE : DEMUX_FILTER_DISABLE );
-            return true;
-        }
-        p_demux = p_demux->p_next;
+
+     if( strcmp( module_get_name( p_demux->p_module, false ), psz_demux) == 0 ||
+         strcmp( module_get_name( p_demux->p_module, true ), psz_demux ) == 0 )
+     {
+        demux_Control( p_demux,
+                       b_enable ? DEMUX_FILTER_ENABLE : DEMUX_FILTER_DISABLE );
+        return true;
     }
     return false;
 }



More information about the vlc-commits mailing list