1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

libavformat/concatdec: remove support for unsafe=-1

It only makes sense as the default value,
but it is not the default since 689211d572.
This commit is contained in:
Nicolas George 2021-07-28 12:38:08 +02:00
parent 5b258c2770
commit 46fb395952
2 changed files with 5 additions and 10 deletions

View File

@ -96,8 +96,7 @@ backslash or single quotes.
All subsequent file-related directives apply to that file. All subsequent file-related directives apply to that file.
@item @code{ffconcat version 1.0} @item @code{ffconcat version 1.0}
Identify the script type and version. It also sets the @option{safe} option Identify the script type and version.
to 1 if it was -1.
To make FFmpeg recognize the format automatically, this directive must 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 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 @table @option
@item safe @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 does not contain a protocol specification and is relative and all components
only contain characters from the portable character set (letters, digits, only contain characters from the portable character set (letters, digits,
period, underscore and hyphen) and have no period at the beginning of a 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. The default is 1.
-1 is equivalent to 1 if the format was automatically
probed and 0 otherwise.
@item auto_convert @item auto_convert
If set to 1, try to perform automatic conversions on packet data to make the If set to 1, try to perform automatic conversions on packet data to make the
streams concatenable. streams concatenable.

View File

@ -118,7 +118,7 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
size_t url_len; size_t url_len;
int ret; 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); av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename);
FAIL(AVERROR(EPERM)); 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); av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line);
FAIL(AVERROR_INVALIDDATA); FAIL(AVERROR_INVALIDDATA);
} }
if (cat->safe < 0)
cat->safe = 1;
} else { } else {
av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n", av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n",
line, keyword); line, keyword);
@ -757,7 +755,7 @@ static int concat_seek(AVFormatContext *avf, int stream,
static const AVOption options[] = { static const AVOption options[] = {
{ "safe", "enable safe mode", { "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", { "auto_convert", "automatically convert bitstream format",
OFFSET(auto_convert), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC }, 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", { "segment_time_metadata", "output file segment start time and duration as packet metadata",