From patchwork Thu Feb 25 06:38:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 25977 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 20310449E75 for ; Thu, 25 Feb 2021 08:49:00 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0498768A27A; Thu, 25 Feb 2021 08:49:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CFD5B68A199 for ; Thu, 25 Feb 2021 08:48:52 +0200 (EET) IronPort-SDR: t/jRzYcjgVlpXBoLkXFjNIP70Hn6RWqN6WG6Dnwnglcy2rJM1NVVuRpvWMZEKYWQJlhFzPrvFV KER8IEAtPGkw== X-IronPort-AV: E=McAfee;i="6000,8403,9905"; a="182968990" X-IronPort-AV: E=Sophos;i="5.81,205,1610438400"; d="scan'208";a="182968990" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:48:48 -0800 IronPort-SDR: 194NJkTUl8m3FSQ4eQenpzQLwoUH3zKmzNYqeQJGB3ck+UDDUnmEs8n8cCTZAn5ndKdWj5Eu+f dHsIlB8lxm3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,205,1610438400"; d="scan'208";a="404113297" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.159.53]) by orsmga008.jf.intel.com with ESMTP; 24 Feb 2021 22:48:47 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Feb 2021 14:38:13 +0800 Message-Id: <20210225063816.8644-4-yejun.guo@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210225063816.8644-1-yejun.guo@intel.com> References: <20210225063816.8644-1-yejun.guo@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH V2 4/7] libavformat/dashenc.c: fix build warning for [-Wformat-truncation=] X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: yejun.guo@intel.com Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Part of warning message: src/libavformat/dashenc.c: In function ‘flush_init_segment’: src/libavformat/dashenc.c:608:49: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=] snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); ^~ src/libavformat/dashenc.c:608:9: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024 snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Guo, Yejun --- libavformat/dashenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 2d757b3a87..b11f79c966 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -126,7 +126,7 @@ typedef struct OutputStream { char codec_str[100]; int written_len; char filename[1024]; - char full_path[1024]; + char full_path[2048]; char temp_path[1024]; double availability_time_offset; AVProducerReferenceTime producer_reference_time; @@ -604,7 +604,7 @@ static int flush_init_segment(AVFormatContext *s, OutputStream *os) os->pos = os->init_range_length = range_length; if (!c->single_file) { - char filename[1024]; + char filename[2048]; snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); dashenc_io_close(s, &os->out, filename); } @@ -1480,7 +1480,7 @@ static int dash_init(AVFormatContext *s) AVFormatContext *ctx; AVStream *st; AVDictionary *opts = NULL; - char filename[1024]; + char filename[2048]; os->bit_rate = s->streams[i]->codecpar->bit_rate; if (!os->bit_rate) {