diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-10-31 23:46:33 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-09 13:53:29 +0200 |
commit | 4ed66956584c881c29b1381fbd573adeaa5c4338 (patch) | |
tree | fbf51d1b14c5e896c75e2057ac5ec398f1188e11 /libavformat/concatdec.c | |
parent | 26db6eccce82d3e44c3d0d0257f8f579b3326018 (diff) | |
download | ffmpeg-4ed66956584c881c29b1381fbd573adeaa5c4338.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>
Diffstat (limited to 'libavformat/concatdec.c')
-rw-r--r-- | libavformat/concatdec.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index bbe13136fa..9284476de4 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -112,7 +112,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)) { @@ -121,9 +122,8 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile, } proto = avio_find_protocol_name(filename); - proto_len = proto ? strlen(proto) : 0; - if (proto && !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 { |