Skip to content

Commit

Permalink
avformat/cafdec: Check channels
Browse files Browse the repository at this point in the history
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 641c1db)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
  • Loading branch information
michaelni committed Jun 18, 2021
1 parent 48be6b2 commit 3d2af8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libavformat/cafdec.c
Expand Up @@ -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 */
Expand Down

0 comments on commit 3d2af8a

Please sign in to comment.