aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-11-05 21:22:13 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commit471c8ae5b6eb632930585590fafbd74b7d39b74e (patch)
tree0ee6562481d8012f3e73c3838cae5c8df0b44c9a
parent6eba6551b81b36e7233601f5a1f8b4c184a16890 (diff)
downloadffmpeg-471c8ae5b6eb632930585590fafbd74b7d39b74e.tar.gz
avformat/dsfdec: Check block_align more completely
Fixes: infinite loop Fixes: 26865/clusterfuzz-testcase-minimized-ffmpeg_dem_DSF_fuzzer-5649473830912000 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 65b8974d54455adc7a462f0f7385b76e1d08101c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/dsfdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c
index 5e06fd63a5..e0a8f7212c 100644
--- a/libavformat/dsfdec.c
+++ b/libavformat/dsfdec.c
@@ -124,8 +124,8 @@ static int dsf_read_header(AVFormatContext *s)
dsf->audio_size = avio_rl64(pb) / 8 * st->codecpar->channels;
st->codecpar->block_align = avio_rl32(pb);
- if (st->codecpar->block_align > INT_MAX / st->codecpar->channels) {
- avpriv_request_sample(s, "block_align overflow");
+ if (st->codecpar->block_align > INT_MAX / st->codecpar->channels || st->codecpar->block_align <= 0) {
+ avpriv_request_sample(s, "block_align invalid");
return AVERROR_INVALIDDATA;
}
st->codecpar->block_align *= st->codecpar->channels;