diff mbox series

[FFmpeg-devel,1/6] avformat/cafdec: Check channels

Message ID 20210410222446.3012-1-michael@niedermayer.cc
State Accepted
Commit 641c1db22bb27752b925293ad93f68843baa43bf
Headers show
Series [FFmpeg-devel,1/6] avformat/cafdec: Check channels
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer April 10, 2021, 10:24 p.m. UTC
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>
---
 libavformat/cafdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer April 20, 2021, 2:34 p.m. UTC | #1
On Sun, Apr 11, 2021 at 12:24:41AM +0200, Michael Niedermayer wrote:
> 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>
> ---
>  libavformat/cafdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 2a9299d777..d97ca45ab8 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 */