]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_asf.c
Do not try to parse empty strf tags.
[ffmpeg] / libavformat / rtpdec_asf.c
index 4f776453d7ed5f9fd34030c4d366a4e7f6a469b7..b481c37c8206eaf0e6c9dbc2d0d9f5ef7eb6940b 100644 (file)
@@ -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);