Browse code

rtpdec_asf: Propagate errors from the chained av_open_input_stream

This fixes the crash in issue 2070.

Originally committed as revision 24059 to svn://svn.ffmpeg.org/ffmpeg/trunk

Martin Storsjö authored on 2010/07/06 01:46:00
Showing 2 changed files
... ...
@@ -91,8 +91,9 @@ static void init_packetizer(ByteIOContext *pb, uint8_t *buf, int len)
91 91
     pb->buf_end = buf + len;
92 92
 }
93 93
 
94
-void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
94
+int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
95 95
 {
96
+    int ret = 0;
96 97
     if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
97 98
         ByteIOContext pb;
98 99
         RTSPState *rt = s->priv_data;
... ...
@@ -108,11 +109,14 @@ void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
108 108
             av_close_input_stream(rt->asf_ctx);
109 109
             rt->asf_ctx = NULL;
110 110
         }
111
-        av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL);
111
+        ret = av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL);
112
+        if (ret < 0)
113
+            return ret;
112 114
         rt->asf_pb_pos = url_ftell(&pb);
113 115
         av_free(buf);
114 116
         rt->asf_ctx->pb = NULL;
115 117
     }
118
+    return ret;
116 119
 }
117 120
 
118 121
 static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index,
... ...
@@ -30,7 +30,7 @@
30 30
  *
31 31
  * @param s RTSP demux context
32 32
  */
33
-void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p);
33
+int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p);
34 34
 
35 35
 /**
36 36
  * Handlers for the x-asf-pf payloads (the payload ID for RTP/ASF).