aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/aiffdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-03-22 23:07:01 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2024-04-01 18:59:07 +0200
commit23b29f72eeb2ff6f2176ee74b9abe78aec4cd1f4 (patch)
tree1295208200927fc9b09e6fa281bf36f196602f2e /libavformat/aiffdec.c
parentf30fe5e8d002e15f07eaacf720c5654097cb62df (diff)
downloadffmpeg-23b29f72eeb2ff6f2176ee74b9abe78aec4cd1f4.tar.gz
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>
Diffstat (limited to 'libavformat/aiffdec.c')
-rw-r--r--libavformat/aiffdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index eb565054e7..bd5bd2e4bb 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -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);