[vlc-devel] [PATCH] input: fix use after free

Tristan Matthews le.businessman at gmail.com
Fri Aug 1 05:46:19 CEST 2014


---
 src/input/input.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 87bbfe8..363b1a4 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2413,17 +2413,24 @@ static int InputSourceInit( input_thread_t *p_input,
 
         if( in->p_demux == NULL )
         {
+            /* cache info since it may be freed in stream_Delete */
+            char *err_str;
+            if( asprintf( &err_str, "no suitable demux module for `%s/%s://%s'",
+                          psz_access, psz_demux, psz_path ) < 0 )
+                err_str = NULL;
+
             stream_Delete( p_stream );
             if( vlc_object_alive( p_input ) )
             {
-                msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
-                         psz_access, psz_demux, psz_path );
+                if( err_str )
+                    msg_Err( p_input, "%s", err_str );
                 if( !b_in_can_fail )
                     dialog_Fatal( VLC_OBJECT( p_input ),
                                   _("VLC can't recognize the input's format"),
                                   _("The format of '%s' cannot be detected. "
                                     "Have a look at the log for details."), psz_mrl );
             }
+            free( err_str );
             goto error;
         }
         assert( in->p_demux->pf_demux != NULL );
-- 
1.9.1




More information about the vlc-devel mailing list