aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-31 23:46:33 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:19 +0200
commitf1f6d6c861241b35a9fd1b7fea5526d807571c70 (patch)
tree6c07e13ae92b4933bb13bba6a803840bcf18aacd
parent021e2b9cf141e229cb36fcb8e6b5a2c6259a9f0f (diff)
downloadffmpeg-f1f6d6c861241b35a9fd1b7fea5526d807571c70.tar.gz
avformat/concatdec: use av_strstart()
Fixes: out array read Fixes: 26610/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-5631838049271808 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 2610acb49a140901dacbd36c598a5514cf9ade0d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/concatdec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 3d843173e8..675926a0b1 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -111,7 +111,8 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
ConcatFile *file;
char *url = NULL;
const char *proto;
- size_t url_len, proto_len;
+ const char *ptr;
+ size_t url_len;
int ret;
if (cat->safe > 0 && !safe_filename(filename)) {
@@ -120,9 +121,8 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
}
proto = avio_find_protocol_name(filename);
- proto_len = proto ? strlen(proto) : 0;
- if (!memcmp(filename, proto, proto_len) &&
- (filename[proto_len] == ':' || filename[proto_len] == ',')) {
+ if (proto && av_strstart(filename, proto, &ptr) &&
+ (*ptr == ':' || *ptr == ',')) {
url = filename;
filename = NULL;
} else {