mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 01:02:33 +00:00
avformat/boadec: Check that channels and block_align are set
Fixes: Infinite loop Fixes: 26381/clusterfuzz-testcase-minimized-ffmpeg_dem_BOA_fuzzer-5745789089087488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2be51d14f2
commit
44ff5a1bff
@ -54,12 +54,12 @@ static int read_header(AVFormatContext *s)
|
|||||||
avio_rl32(s->pb);
|
avio_rl32(s->pb);
|
||||||
st->codecpar->sample_rate = avio_rl32(s->pb);
|
st->codecpar->sample_rate = avio_rl32(s->pb);
|
||||||
st->codecpar->channels = avio_rl32(s->pb);
|
st->codecpar->channels = avio_rl32(s->pb);
|
||||||
if (st->codecpar->channels > FF_SANE_NB_CHANNELS)
|
if (st->codecpar->channels > FF_SANE_NB_CHANNELS || st->codecpar->channels <= 0)
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
s->internal->data_offset = avio_rl32(s->pb);
|
s->internal->data_offset = avio_rl32(s->pb);
|
||||||
avio_r8(s->pb);
|
avio_r8(s->pb);
|
||||||
st->codecpar->block_align = avio_rl32(s->pb);
|
st->codecpar->block_align = avio_rl32(s->pb);
|
||||||
if (st->codecpar->block_align > INT_MAX / FF_SANE_NB_CHANNELS)
|
if (st->codecpar->block_align > INT_MAX / FF_SANE_NB_CHANNELS || st->codecpar->block_align <= 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
st->codecpar->block_align *= st->codecpar->channels;
|
st->codecpar->block_align *= st->codecpar->channels;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user