mirror of https://git.ffmpeg.org/ffmpeg.git
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 c78b2b138c
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
aa63110c1d
commit
d5b6c4dd0e
|
@ -34,8 +34,9 @@ static int ads_probe(const AVProbeData *p)
|
||||||
|
|
||||||
static int ads_read_header(AVFormatContext *s)
|
static int ads_read_header(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
int align, codec, size;
|
int align, codec;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
|
int64_t size;
|
||||||
|
|
||||||
st = avformat_new_stream(s, NULL);
|
st = avformat_new_stream(s, NULL);
|
||||||
if (!st)
|
if (!st)
|
||||||
|
@ -62,7 +63,7 @@ static int ads_read_header(AVFormatContext *s)
|
||||||
st->codecpar->block_align = st->codecpar->channels * align;
|
st->codecpar->block_align = st->codecpar->channels * align;
|
||||||
avio_skip(s->pb, 12);
|
avio_skip(s->pb, 12);
|
||||||
size = avio_rl32(s->pb);
|
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;
|
st->duration = (size - 0x40) / 16 / st->codecpar->channels * 28;
|
||||||
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
|
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue