aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-09 22:46:13 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-11 21:23:49 +0200
commitb4eeac2a1bb3b061783bfcb203c968413d1ccb70 (patch)
tree9155b9738076e644acc1c8751059151cadc895d7
parent6128c6f3384052696d97ffacfc79d5d374eb3991 (diff)
downloadffmpeg-b4eeac2a1bb3b061783bfcb203c968413d1ccb70.tar.gz
avformat/cafdec: Check channels
Fixes: signed integer overflow: -1184429040541376544 * 32 cannot be represented in type 'long' Fixes: 31788/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6236746338664448 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 641c1db22bb27752b925293ad93f68843baa43bf) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/cafdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 197001667c..4817b90b0b 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -79,7 +79,7 @@ static int read_desc_chunk(AVFormatContext *s)
st->codecpar->channels = avio_rb32(pb);
st->codecpar->bits_per_coded_sample = avio_rb32(pb);
- if (caf->bytes_per_packet < 0 || caf->frames_per_packet < 0)
+ if (caf->bytes_per_packet < 0 || caf->frames_per_packet < 0 || st->codecpar->channels < 0)
return AVERROR_INVALIDDATA;
/* calculate bit rate for constant size packets */