aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/brstm.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-09-10 17:23:41 +0200
committerPaul B Mahol <onemda@gmail.com>2020-09-10 17:38:08 +0200
commitf4b84d89d1cf17835a1ed2d2b8a0cfa08b810fe9 (patch)
treef4e8bcd2786863cb31a8c4adfa96c94767dca6da /libavformat/brstm.c
parent38be47017baff232d17a2964c8d82d55de5203d2 (diff)
downloadffmpeg-f4b84d89d1cf17835a1ed2d2b8a0cfa08b810fe9.tar.gz
avformat/brstm: clip timestamp when seeking into acceptable range
Diffstat (limited to 'libavformat/brstm.c')
-rw-r--r--libavformat/brstm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index ca965ed7e1..a63c7ee5ab 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -446,7 +446,11 @@ static int read_seek(AVFormatContext *s, int stream_index,
BRSTMDemuxContext *b = s->priv_data;
int64_t ret = 0;
+ if (timestamp < 0)
+ timestamp = 0;
timestamp /= b->samples_per_block;
+ if (timestamp >= b->block_count)
+ timestamp = b->block_count - 1;
ret = avio_seek(s->pb, b->data_start + timestamp * b->block_size *
st->codecpar->channels, SEEK_SET);
if (ret < 0)