diff options
author | Michael Niedermayer <[email protected]> | 2021-01-31 16:14:03 +0100 |
---|---|---|
committer | Michael Niedermayer <[email protected]> | 2021-09-10 16:04:26 +0200 |
commit | ac7566e2d8eca69924990d30658eb7a282cb2367 (patch) | |
tree | 1869826ab6d1b061091b058aa9f2820ea3e48839 | |
parent | ae3364bc305caa3c006e027eedd014f3df53c906 (diff) |
avformat/id3v2: Check the return from avio_get_str()
Fixes: out of array access
Fixes: 29446/clusterfuzz-testcase-minimized-ffmpeg_dem_AAC_fuzzer-5096222622875648
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 25f240fcb398eb499ca4b70c026a8bb9f2a32731)
Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r-- | libavformat/id3v2.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 036e9df9c9..70ee4c911f 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -611,7 +611,10 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen, /* mimetype */ if (isv34) { - taglen -= avio_get_str(pb, taglen, mimetype, sizeof(mimetype)); + int ret = avio_get_str(pb, taglen, mimetype, sizeof(mimetype)); + if (ret < 0 || ret >= taglen) + goto fail; + taglen -= ret; } else { if (avio_read(pb, mimetype, 3) < 0) goto fail; |