diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-10-20 21:44:32 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-10-25 09:49:31 +0100 |
commit | b23a619c132a8ad5282a5fd02bfe8b253101c79d (patch) | |
tree | 5e757ccc8169429eab7cf4bee900c9f669718250 | |
parent | 80bc2ac3c06319cf85428c58c471d105d25ae987 (diff) | |
download | ffmpeg-b23a619c132a8ad5282a5fd02bfe8b253101c79d.tar.gz |
avformat/pcm: Check block_align
Fixes: signed integer overflow: 321 * 8746632 cannot be represented in type 'int'
Fixes: 26461/clusterfuzz-testcase-minimized-ffmpeg_dem_PVF_fuzzer-6326427831762944
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/pcm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/pcm.c b/libavformat/pcm.c index 767bbd045a..1effc0b6f8 100644 --- a/libavformat/pcm.c +++ b/libavformat/pcm.c @@ -39,7 +39,11 @@ int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt) * Clamp to RAW_SAMPLES if larger. */ size = FFMAX(par->sample_rate/25, 1); - size = FFMIN(size, RAW_SAMPLES) * par->block_align; + if (par->block_align <= INT_MAX / RAW_SAMPLES) { + size = FFMIN(size, RAW_SAMPLES) * par->block_align; + } else { + size = par->block_align; + } ret = av_get_packet(s->pb, pkt, size); |