aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-02-24 17:03:11 +0100
committerPaul B Mahol <onemda@gmail.com>2021-02-24 17:04:40 +0100
commit8213f0a7f7e64c81a275118ac00decbaa96e040a (patch)
treec586f517a833868587b9f50df2243b795cd2b1fd
parent45a29029761297535296ddf66bcdeca3086a468d (diff)
downloadffmpeg-8213f0a7f7e64c81a275118ac00decbaa96e040a.tar.gz
avformat/vpk: check that samples_per_block is > 0
Fixes floating point exception.
-rw-r--r--libavformat/vpk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/vpk.c b/libavformat/vpk.c
index b1df4e0dfd..f7f20548dc 100644
--- a/libavformat/vpk.c
+++ b/libavformat/vpk.c
@@ -121,7 +121,10 @@ static int vpk_read_seek(AVFormatContext *s, int stream_index,
int64_t ret = 0;
samples_per_block = av_get_audio_frame_duration2(par, par->block_align);
- timestamp /= samples_per_block;
+ if (samples_per_block > 0)
+ timestamp /= samples_per_block;
+ else
+ return -1;
ret = avio_seek(s->pb, vpk->data_start + timestamp * par->block_align, SEEK_SET);
if (ret < 0)
return ret;