aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-06 23:42:39 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-11 21:23:48 +0200
commit71f0cfd327d6cf13c96ec424fc20dd58eca67cf3 (patch)
treea32550afd3225363af17fee9dcd92e6c0df05d7d /libavformat
parent6d96e983f15c496c7df6953f891d588e9254a421 (diff)
downloadffmpeg-71f0cfd327d6cf13c96ec424fc20dd58eca67cf3.tar.gz
avformat/nuv: Check channels
Fixes: signed integer overflow: -3468545475927866368 * 4 cannot be represented in type 'long' Fixes: 28879/clusterfuzz-testcase-minimized-ffmpeg_dem_NUV_fuzzer-6303367307591680 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 fc45d924d7ff6be80e90870540ba35efc290e428) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/nuv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 9bdea4ab55..2be22f9f51 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -121,6 +121,10 @@ static int get_codec_data(AVFormatContext *s, AVIOContext *pb, AVStream *vst,
ast->codecpar->bits_per_coded_sample = avio_rl32(pb);
ast->codecpar->channels = avio_rl32(pb);
ast->codecpar->channel_layout = 0;
+ if (ast->codecpar->channels <= 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid channels %d\n", ast->codecpar->channels);
+ return AVERROR_INVALIDDATA;
+ }
id = ff_wav_codec_get_id(ast->codecpar->codec_tag,
ast->codecpar->bits_per_coded_sample);