]> git.sesse.net Git - ffmpeg/commitdiff
avformat/dsfdec: Check block_align more completely
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 5 Nov 2020 20:22:13 +0000 (21:22 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 6 Dec 2020 20:00:03 +0000 (21:00 +0100)
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>
libavformat/dsfdec.c

index c9740cf28f6b0975c4179ed4f241597f5a22b4d9..1df163e114c9e191e43eef40451ce590ab02b3e2 100644 (file)
@@ -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;