[FFmpeg-cvslog] avformat/vpk: check that samples_per_block is > 0
Paul B Mahol
git at videolan.org
Wed Feb 24 18:04:57 EET 2021
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Feb 24 17:03:11 2021 +0100| [8213f0a7f7e64c81a275118ac00decbaa96e040a] | committer: Paul B Mahol
avformat/vpk: check that samples_per_block is > 0
Fixes floating point exception.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8213f0a7f7e64c81a275118ac00decbaa96e040a
---
libavformat/vpk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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;
More information about the ffmpeg-cvslog
mailing list