diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-11-07 21:39:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-11 21:23:48 +0200 |
commit | 7dcf0f1ebbfefede61d89ffccf932584fedde034 (patch) | |
tree | 3630f77d3e16430aef0b18721d1028135f3ce312 | |
parent | 8d4d02c13a1e68f8de7647af16f20178d5a1e792 (diff) | |
download | ffmpeg-7dcf0f1ebbfefede61d89ffccf932584fedde034.tar.gz |
avformat/id3v2: Sanity check tlen before alloc and uncompress
Fixes: Timeout (>20sec -> 65ms)
Fixes: 26896/clusterfuzz-testcase-minimized-ffmpeg_dem_DAUD_fuzzer-5691024049176576
Fixes: 27627/clusterfuzz-testcase-minimized-ffmpeg_dem_AEA_fuzzer-4907019324358656
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d7f87a4b9ef18a9846439b7787874cc11e5940de)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/id3v2.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index ac39b03af4..f52e28951d 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -1002,6 +1002,9 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata, av_log(s, AV_LOG_DEBUG, "Compresssed frame %s tlen=%d dlen=%ld\n", tag, tlen, dlen); + if (tlen <= 0) + goto seek; + av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen); if (!uncompressed_buffer) { av_log(s, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", dlen); |