[FFmpeg-devel] [PATCH 4/7] avformat/nistspheredec: Check bits_per_coded_sample and channels
Michael Niedermayer
michael at niedermayer.cc
Sun Jan 17 01:07:26 EET 2021
Fixes: signed integer overflow: 80 * 92233009 cannot be represented in type 'int'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_NISTSPHERE_fuzzer-6669100654919680
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavformat/nistspheredec.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/nistspheredec.c b/libavformat/nistspheredec.c
index 079369929f..fec5c88892 100644
--- a/libavformat/nistspheredec.c
+++ b/libavformat/nistspheredec.c
@@ -80,7 +80,9 @@ static int nist_read_header(AVFormatContext *s)
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
- st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8;
+ if (st->codecpar->bits_per_coded_sample * (uint64_t)st->codecpar->channels / 8 > INT_MAX)
+ return AVERROR_INVALIDDATA;
+ st->codecpar->block_align = st->codecpar->bits_per_coded_sample * (uint64_t)st->codecpar->channels / 8;
if (avio_tell(s->pb) > header_size)
return AVERROR_INVALIDDATA;
--
2.17.1
More information about the ffmpeg-devel
mailing list