]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_asf.c
rtpproto: Check the size before reading buf[1]
[ffmpeg] / libavformat / rtpdec_asf.c
index 483b196d6208e251ca54368dea3154434f1a584b..e42565069651dbbfa215c3bc762ce528313dae3d 100644 (file)
@@ -99,6 +99,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
     if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
         AVIOContext pb;
         RTSPState *rt = s->priv_data;
+        AVDictionary *opts = NULL;
         int len = strlen(p) * 6 / 8;
         char *buf = av_mallocz(len);
         av_base64_decode(buf, p, len);
@@ -113,7 +114,9 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
         if (!(rt->asf_ctx = avformat_alloc_context()))
             return AVERROR(ENOMEM);
         rt->asf_ctx->pb      = &pb;
-        ret = avformat_open_input(&rt->asf_ctx, "", &ff_asf_demuxer, NULL);
+        av_dict_set(&opts, "no_resync_search", "1", 0);
+        ret = avformat_open_input(&rt->asf_ctx, "", &ff_asf_demuxer, &opts);
+        av_dict_free(&opts);
         if (ret < 0)
             return ret;
         av_dict_copy(&s->metadata, rt->asf_ctx->metadata, 0);
@@ -127,6 +130,8 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
 static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index,
                                  PayloadContext *asf, const char *line)
 {
+    if (stream_index < 0)
+        return 0;
     if (av_strstart(line, "stream:", &line)) {
         RTSPState *rt = s->priv_data;
 
@@ -163,7 +168,8 @@ struct PayloadContext {
 static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
                                AVStream *st, AVPacket *pkt,
                                uint32_t *timestamp,
-                               const uint8_t *buf, int len, int flags)
+                               const uint8_t *buf, int len, uint16_t seq,
+                               int flags)
 {
     AVIOContext *pb = &asf->pb;
     int res, mflags, len_off;
@@ -256,7 +262,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
     for (;;) {
         int i;
 
-        res = av_read_packet(rt->asf_ctx, pkt);
+        res = ff_read_packet(rt->asf_ctx, pkt);
         rt->asf_pb_pos = avio_tell(pb);
         if (res != 0)
             break;
@@ -293,7 +299,7 @@ static void asfrtp_free_context(PayloadContext *asf)
 RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
     .enc_name         = s, \
     .codec_type       = t, \
-    .codec_id         = CODEC_ID_NONE, \
+    .codec_id         = AV_CODEC_ID_NONE, \
     .parse_sdp_a_line = asfrtp_parse_sdp_line, \
     .alloc            = asfrtp_new_context, \
     .free             = asfrtp_free_context, \