avformat/id3v2: Check taglen in read_uslt()

Fixes: Timeout (read mostly the same data repeatly)
Fixes: 52457/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-6610706313379840
Fixes: 53098/clusterfuzz-testcase-minimized-ffmpeg_dem_SOL_fuzzer-6481382981632000

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 a798af91d7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-11-18 19:04:47 +01:00
parent da325c45d9
commit f75911ee66
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 2 additions and 2 deletions

View File

@ -376,10 +376,10 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen,
lang[3] = '\0';
taglen -= 3;
if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0)
if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0 || taglen < 0)
goto error;
if (decode_str(s, pb, encoding, &text, &taglen) < 0)
if (decode_str(s, pb, encoding, &text, &taglen) < 0 || taglen < 0)
goto error;
// FFmpeg does not support hierarchical metadata, so concatenate the keys.