aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-06 23:14:13 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-14 23:30:37 +0100
commitd14dd61a3d49cd8d96ff24b03906e24651899a08 (patch)
tree108a67ea579f4da074f87ced5cc2937d8c9c82fe /libavformat
parentb8bb86efe7e1f107f2001e1aea3c5839c5dcaa58 (diff)
downloadffmpeg-d14dd61a3d49cd8d96ff24b03906e24651899a08.tar.gz
avformat/vpk: Fix integer overflow in samples_per_block computation
Fixes: signed integer overflow: 84026453 * 28 cannot be represented in type 'int' Fixes: 15111/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5675630072430592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 8c6c4129b4cc3b9e0b3a527a5a15c904ec6ae3b6) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/vpk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/vpk.c b/libavformat/vpk.c
index bb9eabb2ba..0a058b9d7f 100644
--- a/libavformat/vpk.c
+++ b/libavformat/vpk.c
@@ -56,12 +56,12 @@ static int vpk_read_header(AVFormatContext *s)
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX;
st->codecpar->block_align = avio_rl32(s->pb);
st->codecpar->sample_rate = avio_rl32(s->pb);
- if (st->codecpar->sample_rate <= 0)
+ if (st->codecpar->sample_rate <= 0 || st->codecpar->block_align <= 0)
return AVERROR_INVALIDDATA;
st->codecpar->channels = avio_rl32(s->pb);
if (st->codecpar->channels <= 0)
return AVERROR_INVALIDDATA;
- samples_per_block = ((st->codecpar->block_align / st->codecpar->channels) * 28) / 16;
+ samples_per_block = ((st->codecpar->block_align / st->codecpar->channels) * 28LL) / 16;
if (samples_per_block <= 0)
return AVERROR_INVALIDDATA;
vpk->block_count = (st->duration + (samples_per_block - 1)) / samples_per_block;