[FFmpeg-cvslog] r26077 - trunk/libavformat/rtsp.c

mstorsjo subversion
Thu Dec 23 16:05:24 CET 2010


Author: mstorsjo
Date: Thu Dec 23 16:05:24 2010
New Revision: 26077

Log:
rtsp: Require the transport reply from the server to match the request

This fixes a crash if we requested TCP interleaved transport, but the
server replies with transport data for UDP. According to the RFC, the
server isn't allowed to respond with another transport type than the
one requested.

Modified:
   trunk/libavformat/rtsp.c

Modified: trunk/libavformat/rtsp.c
==============================================================================
--- trunk/libavformat/rtsp.c	Wed Dec 22 21:00:42 2010	(r26076)
+++ trunk/libavformat/rtsp.c	Thu Dec 23 16:05:24 2010	(r26077)
@@ -1111,11 +1111,12 @@ static int make_setup_request(AVFormatCo
             rt->transport = reply->transports[0].transport;
         }
 
-        /* close RTP connection if not chosen */
-        if (reply->transports[0].lower_transport != RTSP_LOWER_TRANSPORT_UDP &&
-            (lower_transport == RTSP_LOWER_TRANSPORT_UDP)) {
-            url_close(rtsp_st->rtp_handle);
-            rtsp_st->rtp_handle = NULL;
+        /* Fail if the server responded with another lower transport mode
+         * than what we requested. */
+        if (reply->transports[0].lower_transport != lower_transport) {
+            av_log(s, AV_LOG_ERROR, "Nonmatching transport in server reply\n");
+            err = AVERROR_INVALIDDATA;
+            goto fail;
         }
 
         switch(reply->transports[0].lower_transport) {



More information about the ffmpeg-cvslog mailing list