From patchwork Wed Jul 28 12:15:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29085 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp5736408pxb; Wed, 28 Jul 2021 05:15:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBgTZ43yxkHCGb8+IMmddC5jTNxbJviLTFSBdA+pTgrg2D3GP3Pm2QAGQ4qJVIeTMwWVVT X-Received: by 2002:a17:907:1b11:: with SMTP id mp17mr27103924ejc.1.1627474533194; Wed, 28 Jul 2021 05:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627474533; cv=none; d=google.com; s=arc-20160816; b=RA0+NV6CBme7fYyHApPV7zW+rJfAlwE8fimVw9JyyfxXkl80glZEUpdPlRIXt5bc+5 tdThrl2d+4njspDnyuumKeKHkxHNncK58oUFW2uj0xD7G6JZLs1jcHj/1YXxIh/7EbZQ Z2wPUHXvPM1V90oe6Y8wD3LCHYTjR+SN0Y+3H5amQP4hg/yzfFlJ0eoLAn4udxbo+Ail B8FksgA3F9sY3jU4ijCkEePaXKAIg2uesW/HZDiy+WpzfPbuRFPvz+lCfWVEL0niAyBi l1isxFfpL8RgoCZsmmBl9pSgWkplahBdOzmdx2ltmQMUZNQJqSUSk/hVOJxLyq3O5GPv ESUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=sLdO2nD7ygfsC0xdQPZFvdpBQ/GFVx/AjSAINg/w+qo=; b=Vc8FG6cazJiIDpzqrMpwq0oLi1iMgi0ItqA5FpgFvACdCDnrEbSiO6Ih/kFTXC/86g bEHBmFjwPTvZkl7pptfkg7X28iB826xSHc92or/TJg2jNtxoN8p1Ih281mkEBPr9EXk8 QfkJvCuKZHSrb3BcHHcZ2e7HNeX7KoPaPi9ZHjTZz+8QHW8RFGj1fPHZnY8Ys2d56KS9 MC9ldgNJfARGWQ44Fnf/gdpQDYMyU1owd6V0qotoo8WqMUqfYyQi6p61OsKcRwaFm5aP H7NSd8p+0W7yqLsNOv1rKHQtqCrkuLeA5VLgEVuYmZEuBM38tFJKHZD2u77vmUuflJzf ZfXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id cb18si4773390ejb.171.2021.07.28.05.15.31; Wed, 28 Jul 2021 05:15:33 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9770E689BFF; Wed, 28 Jul 2021 15:15:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0BC9268081D for ; Wed, 28 Jul 2021 15:15:19 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 16SCFIJt030331 for ; Wed, 28 Jul 2021 14:15:19 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id E9D80E62AD; Wed, 28 Jul 2021 14:15:18 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Jul 2021 14:15:12 +0200 Message-Id: <20210728121517.533173-1-george@nsup.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Wed, 28 Jul 2021 14:15:19 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 1/5] libavformat/concatdec: remove support for unsafe=-1. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: jbz7jUOhB3un It only makes sense as the default value, but it is not the default since 689211d5727231c3fe92762d224dbadebdbf4e30. Signed-off-by: Nicolas George --- 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 74354fce25..3db1693725 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -117,7 +117,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)); } @@ -475,8 +475,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); @@ -756,7 +754,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",