aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-06 23:17:18 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-06-27 17:50:47 +0200
commite73ef454e89dcce85fbc8c12ccb5c6b73c7a343c (patch)
tree1b9d887596cac7f9997b41335881579a17c4bdb0
parenta2ebfb6afe9df2fa51d0ece0a205638fe6e1b832 (diff)
downloadffmpeg-e73ef454e89dcce85fbc8c12ccb5c6b73c7a343c.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);