]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_asf.c
ARM: dca: disable optimised decode_blockcodes() for old gcc
[ffmpeg] / libavformat / rtpdec_asf.c
index 287025f3779482bee99d36fda90800d06bd2b8cc..483b196d6208e251ca54368dea3154434f1a584b 100644 (file)
@@ -33,6 +33,7 @@
 #include "rtsp.h"
 #include "asf.h"
 #include "avio_internal.h"
+#include "internal.h"
 
 /**
  * From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not
@@ -107,8 +108,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
                    "Failed to fix invalid RTSP-MS/ASF min_pktsize\n");
         init_packetizer(&pb, buf, len);
         if (rt->asf_ctx) {
-            av_close_input_file(rt->asf_ctx);
-            rt->asf_ctx = NULL;
+            avformat_close_input(&rt->asf_ctx);
         }
         if (!(rt->asf_ctx = avformat_alloc_context()))
             return AVERROR(ENOMEM);
@@ -141,7 +141,7 @@ static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index,
                         *rt->asf_ctx->streams[i]->codec;
                     rt->asf_ctx->streams[i]->codec->extradata_size = 0;
                     rt->asf_ctx->streams[i]->codec->extradata = NULL;
-                    av_set_pts_info(s->streams[stream_index], 32, 1, 1000);
+                    avpriv_set_pts_info(s->streams[stream_index], 32, 1, 1000);
                 }
            }
         }
@@ -233,8 +233,14 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
 
                 int cur_len = start_off + len_off - off;
                 int prev_len = out_len;
+                void *newmem;
                 out_len += cur_len;
-                asf->buf = av_realloc(asf->buf, out_len);
+                if (FFMIN(cur_len, len - off) < 0)
+                    return -1;
+                newmem = av_realloc(asf->buf, out_len);
+                if (!newmem)
+                    return -1;
+                asf->buf = newmem;
                 memcpy(asf->buf + prev_len, buf + off,
                        FFMIN(cur_len, len - off));
                 avio_skip(pb, cur_len);