[vlc-devel] commit: Avoid segfaulting if live555 error is neither a HTTP or RTSP error ( Jérôme Decoodt )

git version control git at videolan.org
Tue Apr 15 11:51:38 CEST 2008


vlc | branch: master | Jérôme Decoodt <djc+git at videolan.org> | Tue Apr 15 11:50:22 2008 +0200| [96e4e5f43914820bd36c12e8532d5908d678e02d]

Avoid segfaulting if live555 error is neither a HTTP or RTSP error
Avoid an infinite loop for this case too (only 3 tries to connect, then abort)

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

 modules/demux/live555.cpp |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index 7360e3b..1842f56 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -486,7 +486,9 @@ static int Connect( demux_t *p_demux )
         psz_pwd  = var_CreateGetString( p_demux, "rtsp-pwd" );
     }
 
+    int i_lefttries = 3;
 createnew:
+    i_lefttries--;
     if( p_demux->b_die || p_demux->b_error )
     {
         free( psz_user );
@@ -546,7 +548,10 @@ describe:
         else
         {
             const char *psz_tmp = strstr( psz_error, "RTSP" );
-            sscanf( psz_tmp, "RTSP/%*s%3u", &i_code );
+            if( psz_tmp )
+                sscanf( psz_tmp, "RTSP/%*s%3u", &i_code );
+            else
+                i_code = 0;
         }
         msg_Dbg( p_demux, "DESCRIBE failed with %d: %s", i_code, psz_error );
 
@@ -593,7 +598,8 @@ describe:
             msg_Dbg( p_demux, "connection timeout, retrying" );
             if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp );
             p_sys->rtsp = NULL;
-            goto createnew;
+            if( i_lefttries > 0 )
+                goto createnew;
         }
         i_ret = VLC_EGENERIC;
     }




More information about the vlc-devel mailing list