[vlc-devel] [PATCH 1/7] filter_chain: fix potential undefined behavior

Felix Abecassis felix.abecassis at gmail.com
Tue May 6 19:08:25 CEST 2014


If p_chain->first is NULL, we should not take the address of first->filter.
---
 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 )
     {
-- 
1.9.1




More information about the vlc-devel mailing list