summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-06 23:17:18 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:11:55 +0200
commitb07457f4c47c542afeb14ece516f9991e0605eeb (patch)
treef86e983bd8bd7663ea6a19e448a94ad2684afa85
parentbf34934436a8966a090948a59d3b73407f5920c9 (diff)
downloadffmpeg-b07457f4c47c542afeb14ece516f9991e0605eeb.tar.gz
avformat/vpk: Check offset for validity
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit aa003019ab9ec5ef7e7b3ff9d6262d3472b427eb) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/vpk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/vpk.c b/libavformat/vpk.c
index 0a058b9d7f..64a0d56926 100644
--- a/libavformat/vpk.c
+++ b/libavformat/vpk.c
@@ -66,6 +66,9 @@ static int vpk_read_header(AVFormatContext *s)
return AVERROR_INVALIDDATA;
vpk->block_count = (st->duration + (samples_per_block - 1)) / samples_per_block;
vpk->last_block_size = (st->duration % samples_per_block) * 16 * st->codecpar->channels / 28;
+
+ if (offset < avio_tell(s->pb))
+ return AVERROR_INVALIDDATA;
avio_skip(s->pb, offset - avio_tell(s->pb));
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);