diff mbox series

[FFmpeg-devel,5/7] avformat/dsfdec: Check block_align more completely

Message ID 20201105231110.7772-5-michael@niedermayer.cc
State Accepted
Commit 65b8974d54455adc7a462f0f7385b76e1d08101c
Headers show
Series [FFmpeg-devel,1/7,RFC] Revert "avcodec/adpcm_swf: support decoding multiple fixed-sized blocks at once"
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Nov. 5, 2020, 11:11 p.m. UTC
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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Dec. 6, 2020, 4:37 p.m. UTC | #1
On Fri, Nov 06, 2020 at 12:11:08AM +0100, Michael Niedermayer wrote:
> 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 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c
index c9740cf28f..1df163e114 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;