[vlc-commits] commit: rtp : safety check. ( Sébastien Escudier )

git at videolan.org git at videolan.org
Thu Jul 8 08:24:41 CEST 2010


vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Thu Jun 24 08:41:16 2010 +0200| [b445a6a9ffb600e4aa87793c21186d457631d588] | committer: Sébastien Escudier 

rtp : safety check.
There was a small window of opportunity between RtspSetup and RtspAddId where this can happen.

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

 modules/stream_out/rtp.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 0d6779c..7587eff 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -680,9 +680,12 @@ static void SDPHandleUrl( sout_stream_t *p_stream, const char *psz_url )
         if( p_sys->p_mux != NULL )
         {
             sout_stream_id_t *id = p_sys->es[0];
-            id->rtsp_id = RtspAddId( p_sys->rtsp, id, GetDWBE( id->ssrc ),
-                                     p_sys->psz_destination, p_sys->i_ttl,
-                                     id->i_port, id->i_port + 1 );
+            rtsp_stream_id_t *rtsp_id = RtspAddId( p_sys->rtsp, id, GetDWBE( id->ssrc ),
+                                                   p_sys->psz_destination, p_sys->i_ttl,
+                                                   id->i_port, id->i_port + 1 );
+            vlc_mutex_lock( &p_sys->lock_es );
+            id->rtsp_id = rtsp_id;
+            vlc_mutex_unlock( &p_sys->lock_es );
         }
     }
     else if( ( url.psz_protocol && !strcasecmp( url.psz_protocol, "sap" ) ) ||
@@ -742,7 +745,7 @@ char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url )
     int inclport;
 
     vlc_mutex_lock( &p_sys->lock_es );
-    if( unlikely(p_sys->i_es == 0) )
+    if( unlikely(p_sys->i_es == 0 || (rtsp_url != NULL && !p_sys->es[0]->rtsp_id)) )
         goto out; /* hmm... */
 
     if( p_sys->psz_destination != NULL )



More information about the vlc-commits mailing list