diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-01-14 18:38:16 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-09 22:02:20 +0200 |
commit | 55658df3d1b0a314f5a64fcb4e3b1e5c846c5d62 (patch) | |
tree | 9f6e67f05b12247b41e0db9028ea795aa418718e /libavformat | |
parent | 349a1d01c51361c5b823245fc8e06b66a8efbf67 (diff) | |
download | ffmpeg-55658df3d1b0a314f5a64fcb4e3b1e5c846c5d62.tar.gz |
avformat/ads: Check size
Fixes: signed integer overflow: -2147483616 - 64 cannot be represented in type 'int'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_ADS_fuzzer-6617769344892928
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 c78b2b138ce222de2f4cecac8fd4361f05ee9428)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/ads.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/ads.c b/libavformat/ads.c index 73ea7c7d54..45c21a33d4 100644 --- a/libavformat/ads.c +++ b/libavformat/ads.c @@ -34,8 +34,9 @@ static int ads_probe(AVProbeData *p) static int ads_read_header(AVFormatContext *s) { - int align, codec, size; + int align, codec; AVStream *st; + int64_t size; st = avformat_new_stream(s, NULL); if (!st) @@ -62,7 +63,7 @@ static int ads_read_header(AVFormatContext *s) st->codecpar->block_align = st->codecpar->channels * align; avio_skip(s->pb, 12); size = avio_rl32(s->pb); - if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_PSX) + if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_PSX && size >= 0x40) st->duration = (size - 0x40) / 16 / st->codecpar->channels * 28; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); |