diff mbox series

[FFmpeg-devel,3/3] avformat/aiffdec: Check size before subtraction in get_aiff_header()

Message ID 20201111160102.19731-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/3] avformat/utils: Use av_sat_sub64() in max_analyze_duration check
Related show

Checks

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

Commit Message

Michael Niedermayer Nov. 11, 2020, 4:01 p.m. UTC
Fixes: Infinite loop
Fixes: 27235/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-5761398380167168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/aiffdec.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 15733478e1..4d1c9bbb53 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -120,6 +120,8 @@  static int get_aiff_header(AVFormatContext *s, int size,
     else
         sample_rate = (val + (1ULL<<(-exp-1))) >> -exp;
     par->sample_rate = sample_rate;
+    if (size < 18)
+        return AVERROR_INVALIDDATA;
     size -= 18;
 
     /* get codec id for AIFF-C */