]> git.sesse.net Git - ffmpeg/commitdiff
avformat/id3v2: Check against max compression ratio before allocation
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 28 Nov 2020 22:43:23 +0000 (23:43 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 18 Jan 2021 23:05:50 +0000 (00:05 +0100)
Fixes: Timeout (>10sec -> 12ms)
Fixes: 27612/clusterfuzz-testcase-minimized-ffmpeg_dem_PCM_S24BE_fuzzer-6605893000757248
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/id3v2.c

index 336a3964de91bd55a98d24690a3b077f75f90fe1..97f6cc8a68c96c7fac41d5000cf16f7891d37d51 100644 (file)
@@ -995,6 +995,8 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
 
                     if (tlen <= 0)
                         goto seek;
+                    if (dlen / 32768 > tlen)
+                        goto seek;
 
                     av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen);
                     if (!uncompressed_buffer) {