diff options
author | Marton Balint <cus@passwd.hu> | 2020-09-26 20:30:27 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-10-09 21:07:18 +0200 |
commit | 2933ee8ff09f3a9e2ae313da80b0a510474f53f4 (patch) | |
tree | bd452f3096f870cf9d3bdf99ca01b50c76d5baae | |
parent | a3943c48472ebbef62034c4449462b5126c07007 (diff) | |
download | ffmpeg-2933ee8ff09f3a9e2ae313da80b0a510474f53f4.tar.gz |
avformat/mpegts: make sure mpegts_resync do not run out of the initially requested probe buffer
Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r-- | libavformat/mpegts.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 50d4d5e9bc..432b1c3ea2 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -3051,10 +3051,11 @@ static int mpegts_read_header(AVFormatContext *s) MpegTSContext *ts = s->priv_data; AVIOContext *pb = s->pb; int64_t pos, probesize = s->probesize; + int64_t seekback = FFMAX(s->probesize, (int64_t)ts->resync_size + PROBE_PACKET_MAX_BUF); s->internal->prefer_codec_framerate = 1; - if (ffio_ensure_seekback(pb, probesize) < 0) + if (ffio_ensure_seekback(pb, seekback) < 0) av_log(s, AV_LOG_WARNING, "Failed to allocate buffers for seekback\n"); pos = avio_tell(pb); |