diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-10-17 23:40:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-09 22:02:19 +0200 |
commit | 6455233ff5b96175f0c3ed07ba1c2579b525ac9f (patch) | |
tree | 6070464528b026f87c2cf41ee2e9d5270109f75a /libavformat | |
parent | ad6ab4167307359efea092e29eee45779d03a6f1 (diff) | |
download | ffmpeg-6455233ff5b96175f0c3ed07ba1c2579b525ac9f.tar.gz |
avformat/genh: Check block_align for how it will be used in SDX2_DPCM
Fixes: signed integer overflow: 19922944 * 1024 cannot be represented in type 'int'
Fixes: 26402/clusterfuzz-testcase-minimized-ffmpeg_dem_VMD_fuzzer-5745470053548032
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 c95b47e18fdb43a4c667ae22a5d3a5ee6cf7782d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/genh.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/genh.c b/libavformat/genh.c index b683e026d1..a16d6bae38 100644 --- a/libavformat/genh.c +++ b/libavformat/genh.c @@ -86,7 +86,9 @@ static int genh_read_header(AVFormatContext *s) case 5: st->codecpar->codec_id = st->codecpar->block_align > 0 ? AV_CODEC_ID_PCM_S8_PLANAR : AV_CODEC_ID_PCM_S8; break; - case 6: st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM; break; + case 6: if (st->codecpar->block_align > INT_MAX/1024) + return AVERROR_INVALIDDATA; + st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM; break; case 7: ret = ff_alloc_extradata(st->codecpar, 2); if (ret < 0) return ret; |