aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-25 19:54:19 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:21 +0200
commita971e35df12ffcd916308ad8c82d7707b93656c7 (patch)
treeed886f6f9d6e723b8145da32cb0de05c467e8ae0
parent4748d46ab3ca1bec2c9fb14a4cc4904456bb55e9 (diff)
downloadffmpeg-a971e35df12ffcd916308ad8c82d7707b93656c7.tar.gz
avformat/msf: Check that channels doesnt overflow during extradata construction
Fixes: signed integer overflow: 2048 * 1122336 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_MSF_fuzzer-6726959600107520 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 a1a277926b49dad60d9e78c6c7a8c6b5d0d6d7c9) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/msf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/msf.c b/libavformat/msf.c
index 24654e6569..9032923a25 100644
--- a/libavformat/msf.c
+++ b/libavformat/msf.c
@@ -72,6 +72,8 @@ static int msf_read_header(AVFormatContext *s)
case 4:
case 5:
case 6: st->codecpar->block_align = (codec == 4 ? 96 : codec == 5 ? 152 : 192) * st->codecpar->channels;
+ if (st->codecpar->channels > UINT16_MAX / 2048)
+ return AVERROR_INVALIDDATA;
ret = ff_alloc_extradata(st->codecpar, 14);
if (ret < 0)
return ret;