1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avformat/aiffdec: Check for previously set channels

Fixes: out of array access (av_channel_layout_copy())
Fixes: 67087/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-4920720268263424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-03-22 23:07:01 +01:00
parent f30fe5e8d0
commit 23b29f72ee
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -107,6 +107,8 @@ static int get_aiff_header(AVFormatContext *s, int64_t size,
size++;
par->codec_type = AVMEDIA_TYPE_AUDIO;
channels = avio_rb16(pb);
if (par->ch_layout.nb_channels && par->ch_layout.nb_channels != channels)
return AVERROR_INVALIDDATA;
par->ch_layout.nb_channels = channels;
num_frames = avio_rb32(pb);
par->bits_per_coded_sample = avio_rb16(pb);