diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-11-07 21:39:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-09 22:02:19 +0200 |
commit | 59293038977f109b9c276035c86613a0c159b4ca (patch) | |
tree | 8d45c8f05311c4191d4f368c6af52f67846cc6d4 /libavformat | |
parent | 20a2a36571751d4fe74cd17b60224567dc1de471 (diff) | |
download | ffmpeg-59293038977f109b9c276035c86613a0c159b4ca.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>
Diffstat (limited to 'libavformat')
-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 afed5b0468..6d32731aca 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -990,6 +990,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); |