aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-31 16:14:03 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commitd474fa3e3c24ee6cc07f51f8c9af85e12d080164 (patch)
treed35aedc91102932cd30d159395c5145dd0d5e468
parentd472de012ab87e2d608681195c494f113130d013 (diff)
downloadffmpeg-d474fa3e3c24ee6cc07f51f8c9af85e12d080164.tar.gz
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 <michael@niedermayer.cc> (cherry picked from commit 25f240fcb398eb499ca4b70c026a8bb9f2a32731) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/id3v2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 6d32731aca..03f70cc765 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -609,7 +609,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;