diff mbox series

[FFmpeg-devel] avformat/mov: Check channels for mov_parse_stsd_audio()

Message ID 20211107133131.10224-1-michael@niedermayer.cc
State Accepted
Commit 3a64a4c58255d45e05eff80c9464ad3bdc2d6463
Headers show
Series [FFmpeg-devel] avformat/mov: Check channels for mov_parse_stsd_audio() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Nov. 7, 2021, 1:31 p.m. UTC
Fixes: signed integer overflow: -776522110086937600 * 16 cannot be represented in type 'long'
Fixes: 40563/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644829447127040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer Nov. 29, 2021, 2:59 p.m. UTC | #1
On Sun, Nov 07, 2021 at 02:31:31PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -776522110086937600 * 16 cannot be represented in type 'long'
> Fixes: 40563/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644829447127040
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 4 ++++
>  1 file changed, 4 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 8a910a3165f..8e85013a235 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2538,6 +2538,10 @@  int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
                 av_log(c->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate);
                 return AVERROR_INVALIDDATA;
             }
+            if (st->codecpar->channels < 0) {
+                av_log(c->fc, AV_LOG_ERROR, "Invalid channels %d\n", st->codecpar->channels);
+                return AVERROR_INVALIDDATA;
+            }
         } else if (st->codecpar->codec_type==AVMEDIA_TYPE_SUBTITLE){
             mov_parse_stsd_subtitle(c, pb, st, sc,
                                     size - (avio_tell(pb) - start_pos));