From patchwork Tue Mar 19 21:15:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 47234 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8ba5:b0:1a3:31a3:7958 with SMTP id m37csp12786pzh; Tue, 19 Mar 2024 14:15:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWjONsl9VgL3g5E6obq8+xeAL43rZvJuP2qkMNTUQITO54mAM0BrRMaYyYTpJx5PEOR7x7OoVk0YyB8XsmeIq//ZxD6j41qIbceLw== X-Google-Smtp-Source: AGHT+IFkHFH+YDPDzI/7hVOt1QyrMLZD+pfeJ2wNH1fHg1cukJxMCB6jJPM/zaHE1Apu9dO3+WJz X-Received: by 2002:a17:906:3299:b0:a46:b028:7de0 with SMTP id 25-20020a170906329900b00a46b0287de0mr50632ejw.49.1710882939464; Tue, 19 Mar 2024 14:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710882939; cv=none; d=google.com; s=arc-20160816; b=ZFDJFdYoCPxih4YgRm3QsW/Z5HEz1E23csapQc7TNpZsluGC23nkTHTeNFSyXKhX3q azBhmDAgnsHimiH0esowOG60AGrmSqZE8BjTkVBbuDmSEPnoqNPwHqWANsfVwY2mGBtD zV1AQHp3uzNP8fT8MRkFxlyThAANBCILdXqgJTfLCJ5HxmYRs3w7a4a21eeojB8zyY3Z H59QFQS00zkjqd3e/ehGYXHSW2fvfHy2F7TNYtjrPNkJpG+AkzmV9gB754K8o2ruZi5+ wG082+GmSY4rDkqNCpt6zgQHGGEw81lUpph6qUOTmFUJlqSOxbF4z2NnWJEcnMNH3aXK FSpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=dacM+wwAkynaE+SCDvuGkw7CP/Z7kmMCPmbUzlLN1m8=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=fiuouFN1dNxn9J9wVanc1XMY67o3Di+p/ViAtjj0lOAIBBS33bwgW0T3f44P+LCrGd S2HhJp0PE8wgsne+r15ynt0KPfyaf0QLRDvIyoi6J+IlvqWo1ZrRpKzsXyWsWmeUV5qf j6TFPXjt1g2IDgAPC37Xd++uGZegr6DHBjVcC991k48GDF+50QjpTZzdQUart9LXHBvu lZmoGVW2AKKuEJ2hxmWICVu5CRg2iC4lIyjJE+2H/mhYvRS2NwlzjRBgTL8ATPkH63um BeGqY1ZeSHzkJzqgDpmaWlyL3YfOf/O6QwcoiGUpDHqVcjmf683GsBG+AyUGbaXFAm5q YItg==; dara=google.com 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 lg20-20020a170906f89400b00a3e4e20ecdcsi5618352ejb.13.2024.03.19.14.15.39; Tue, 19 Mar 2024 14:15:39 -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 6670A68D442; Tue, 19 Mar 2024 23:15:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5A6DF68D430 for ; Tue, 19 Mar 2024 23:15:16 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 15429EA1C9; Tue, 19 Mar 2024 22:15:16 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jmHf7Z9u9qxj; Tue, 19 Mar 2024 22:15:13 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 8B03AEA225; Tue, 19 Mar 2024 22:15:13 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 19 Mar 2024 22:15:01 +0100 Message-Id: <20240319211504.8342-3-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240319211504.8342-1-cus@passwd.hu> References: <20240319211504.8342-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] avfilter/af_channelmap: disallow channel index 64 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: XVAs3KmqYPQb MAX_CH is 64, therefore the maximum index is 63. Signed-off-by: Marton Balint --- libavfilter/af_channelmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 35dc4c4618..1ecbddd462 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -84,7 +84,7 @@ static char* split(char *message, char delim) { return next; } -static int get_channel_idx(char **map, int *ch, char delim, int max_ch) +static int get_channel_idx(char **map, int *ch, char delim, int max_nb_channels) { char *next; int len; @@ -98,7 +98,7 @@ static int get_channel_idx(char **map, int *ch, char delim, int max_ch) sscanf(*map, "%d%n", ch, &n); if (n != len) return AVERROR(EINVAL); - if (*ch < 0 || *ch > max_ch) + if (*ch < 0 || *ch >= max_nb_channels) return AVERROR(EINVAL); *map = next; return 0;