diff mbox series

[FFmpeg-devel,5/5] avformat/id3v2: Check against max compression ratio before allocation

Message ID 20201129000337.31514-5-michael@niedermayer.cc
State Accepted
Commit c48110a4a4b3ba87cb3ffe66753bff13c618a04d
Headers show
Series [FFmpeg-devel,1/5] avformat/mov: Check a.size before computing next_root_atom | expand

Checks

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

Commit Message

Michael Niedermayer Nov. 29, 2020, 12:03 a.m. UTC
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 | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Jan. 18, 2021, 11:05 p.m. UTC | #1
On Sun, Nov 29, 2020 at 01:03:37AM +0100, Michael Niedermayer wrote:
> 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 | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 336a3964de..97f6cc8a68 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -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) {