[FFmpeg-devel] [PATCH 2/3] avformat/vpk: Check offset for validity

Michael Niedermayer michael at niedermayer.cc
Fri Jun 7 00:50:58 EEST 2019


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/vpk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/vpk.c b/libavformat/vpk.c
index dcc2db329c..255d6030b0 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);
 
-- 
2.21.0



More information about the ffmpeg-devel mailing list