summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2020-11-07 21:39:21 +0100
committerMichael Niedermayer <[email protected]>2021-02-02 14:18:21 +0100
commitb9ea0689ea5829565fbf694ec83679926314afec (patch)
tree484dccba5e0556ce3cdf7dfd443842dc107d9afc
parent6acd99576bc8c0a5c5e72ae13fd0b9608c930bd2 (diff)
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 <[email protected]> (cherry picked from commit d7f87a4b9ef18a9846439b7787874cc11e5940de) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavformat/id3v2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index cecd9b9f6d..336a3964de 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -993,6 +993,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);