[vlc-commits] filter_chain: fix potential undefined behavior

Felix Abecassis git at videolan.org
Wed May 7 19:28:42 CEST 2014


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Tue May  6 17:41:46 2014 +0200| [490324fbc6db912e1367e33487c1711e8dea9384] | committer: Felix Abecassis

filter_chain: fix potential undefined behavior

If p_chain->first is NULL, we should not take the address of first->filter.

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

 src/misc/filter_chain.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index d4c0941..63fbb0f 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -154,10 +154,8 @@ void filter_chain_Delete( filter_chain_t *p_chain )
 void filter_chain_Reset( filter_chain_t *p_chain, const es_format_t *p_fmt_in,
                          const es_format_t *p_fmt_out )
 {
-    filter_t *p_filter;
-
-    while( (p_filter = &p_chain->first->filter) != NULL )
-        filter_chain_DeleteFilterInternal( p_chain, p_filter );
+    while( p_chain->first != NULL )
+        filter_chain_DeleteFilterInternal( p_chain, &p_chain->first->filter );
 
     if( p_fmt_in )
     {



More information about the vlc-commits mailing list