[FFmpeg-cvslog] libavformat/concatdec: remove support for unsafe=-1

Nicolas George git at videolan.org
Sun Aug 22 12:53:00 EEST 2021


ffmpeg | branch: master | Nicolas George <george at nsup.org> | Wed Jul 28 12:38:08 2021 +0200| [46fb395952be32692385449ee214461603480b4b] | committer: Nicolas George

libavformat/concatdec: remove support for unsafe=-1

It only makes sense as the default value,
but it is not the default since 689211d5727231c3fe92762d224dbadebdbf4e30.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46fb395952be32692385449ee214461603480b4b
---

 doc/demuxers.texi       | 9 +++------
 libavformat/concatdec.c | 6 ++----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 5b8cf1bfea..5f18e4551b 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -96,8 +96,7 @@ backslash or single quotes.
 All subsequent file-related directives apply to that file.
 
 @item @code{ffconcat version 1.0}
-Identify the script type and version. It also sets the @option{safe} option
-to 1 if it was -1.
+Identify the script type and version.
 
 To make FFmpeg recognize the format automatically, this directive must
 appear exactly as is (no extra space or byte-order-mark) on the very first
@@ -177,7 +176,8 @@ This demuxer accepts the following option:
 @table @option
 
 @item safe
-If set to 1, reject unsafe file paths. A file path is considered safe if it
+If set to 1, reject unsafe file paths and directives.
+A file path is considered safe if it
 does not contain a protocol specification and is relative and all components
 only contain characters from the portable character set (letters, digits,
 period, underscore and hyphen) and have no period at the beginning of a
@@ -187,9 +187,6 @@ If set to 0, any file name is accepted.
 
 The default is 1.
 
--1 is equivalent to 1 if the format was automatically
-probed and 0 otherwise.
-
 @item auto_convert
 If set to 1, try to perform automatic conversions on packet data to make the
 streams concatenable.
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 934e9c02fc..ed6b9d8044 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -118,7 +118,7 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
     size_t url_len;
     int ret;
 
-    if (cat->safe > 0 && !safe_filename(filename)) {
+    if (cat->safe && !safe_filename(filename)) {
         av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename);
         FAIL(AVERROR(EPERM));
     }
@@ -476,8 +476,6 @@ static int concat_read_header(AVFormatContext *avf)
                 av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line);
                 FAIL(AVERROR_INVALIDDATA);
             }
-            if (cat->safe < 0)
-                cat->safe = 1;
         } else {
             av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n",
                    line, keyword);
@@ -757,7 +755,7 @@ static int concat_seek(AVFormatContext *avf, int stream,
 
 static const AVOption options[] = {
     { "safe", "enable safe mode",
-      OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, DEC },
+      OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC },
     { "auto_convert", "automatically convert bitstream format",
       OFFSET(auto_convert), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC },
     { "segment_time_metadata", "output file segment start time and duration as packet metadata",



More information about the ffmpeg-cvslog mailing list