aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-20 21:44:32 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-02 14:18:21 +0100
commite5c9bae371e384abf6e3e7106dfa85f4d27ebc65 (patch)
tree1517d4be59aa28164308fa53c85b1d4758fa2aaa
parent529af35adee44e5e0bb56e3675915355a87abc05 (diff)
downloadffmpeg-e5c9bae371e384abf6e3e7106dfa85f4d27ebc65.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> (cherry picked from commit b23a619c132a8ad5282a5fd02bfe8b253101c79d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/pcm.c6
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);