From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id AC6E547F01 for ; Fri, 1 Dec 2023 09:08:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 71C2B68CF61; Fri, 1 Dec 2023 11:08:49 +0200 (EET) Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B9F2468CA21 for ; Fri, 1 Dec 2023 11:08:42 +0200 (EET) 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 3B198gss009786 for ; Fri, 1 Dec 2023 10:08:42 +0100 Received: by phare.normalesup.org (Postfix, from userid 1001) id 00E10EB5BB; Fri, 1 Dec 2023 10:08:41 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Fri, 1 Dec 2023 10:08:33 +0100 Message-ID: <20231201090839.3838325-1-george@nsup.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Fri, 01 Dec 2023 10:08:42 +0100 (CET) Subject: [FFmpeg-devel] [PATCH] lavfi/af_pan: fix sscanf return value check 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: sscanf() can return -1 when it reach the end of the string. Fix track ticket #10677. Signed-off-by: Nicolas George --- libavfilter/af_pan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index cfed9f146a..9ab827b396 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -69,7 +69,7 @@ static int parse_channel_name(char **arg, int *rchannel, int *rnamed) skip_spaces(arg); /* try to parse a channel name, e.g. "FL" */ - if (sscanf(*arg, "%7[A-Z]%n", buf, &len)) { + if (sscanf(*arg, "%7[A-Z]%n", buf, &len) >= 1) { channel_id = av_channel_from_string(buf); if (channel_id < 0) return channel_id; @@ -80,7 +80,7 @@ static int parse_channel_name(char **arg, int *rchannel, int *rnamed) return 0; } /* try to parse a channel number, e.g. "c2" */ - if (sscanf(*arg, "c%d%n", &channel_id, &len) && + if (sscanf(*arg, "c%d%n", &channel_id, &len) >= 1 && channel_id >= 0 && channel_id < MAX_CHANNELS) { *rchannel = channel_id; *rnamed = 0; @@ -165,7 +165,7 @@ static av_cold int init(AVFilterContext *ctx) sign = 1; while (1) { gain = 1; - if (sscanf(arg, "%lf%n *%n", &gain, &len, &len)) + if (sscanf(arg, "%lf%n *%n", &gain, &len, &len) >= 1) arg += len; if (parse_channel_name(&arg, &in_ch_id, &named)){ av_log(ctx, AV_LOG_ERROR, -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".