From patchwork Tue Jun 11 13:44:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49798 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:613:0:b0:460:55fa:d5ed with SMTP id 19csp411705vqg; Tue, 11 Jun 2024 06:44:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqKHlJqGxQn2f6HbWFF0Bxt6AHQ7/5jbRFA1z/UZ1vaJZT7w3Cms4hjq8XrDJ6UzZwVWWO0aTKK8YTfJbtL4eso4npKSYuV6N6aQ== X-Google-Smtp-Source: AGHT+IFd9rkuZwCWUKf+y8XT7K7tZQUoIqHq7T/0Gb5C4yCgqIhg35pajWBgTSXfjY5qSppQqJQC X-Received: by 2002:a17:906:52d8:b0:a6e:f7b5:3189 with SMTP id a640c23a62f3a-a6ef7b539c6mr666305966b.76.1718113483972; Tue, 11 Jun 2024 06:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718113483; cv=none; d=google.com; s=arc-20160816; b=F1AAMEy8VV2gLBZDmOBv35ma4b90fTecQdPn2qvPQbPIg+6uSe628nRx4la3GyPVHB NYONwF4uEUGcGMgFrN09zNo47X0l36wMaKvNiaNt3rTeIyyS7F7cg7Pj1AuPx860Dklp OMXEMsB9VwiQbP9ZrxwhuEL+Ih6Bd8lUmC6ZjTbNJu4Tcm5kvHlWGIAH6cxJR5DvU79x RDskRLu4L9kVuGO5LowmIr3/wz+8wymlcsHdLuAyjG5+9gbcHT0d19eK4ZU0XYTdGTWJ F1GCjr3MewQOgtJ7Ql2fR/QnsOgaMrMChMGQTLDlW/nt98yExuA6wLnTqT8theSZBd4O GTPw== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=XtD80Iuq1s4nigcm5piFguUkQeJ1HLkeW2TvGjFhGIE=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=Q1XcOn6hNo9WeyuVBGVElgBjKWiiverF5yxOYLo5tXAoL9fZ8g5cJ+IvOtps+2HdsZ CutVJ1LZfZDuuofgTQVKDJZfxz1GA35zoNDSlZJ+p/UEMLaZPoyBdbsGrcr2yQbASQbB Tln3tdI3R9rnE7suYdG6xZwC34wrLGs2RELtgx5rFvn3YZ63okIIfe/+TGgYcbyR3LDI 7j+/VaxL3eMjI1VYuYiDOwNDtlj2H2c+wfxPG5QmqUq7dpEWVaW/6HgFCfU5iiPYAfku 4+ZoDUO1FChrclv4GxjtoiIPoqAwKJHp99A3sWB0zRxkxlgJ7w6DuQUqirACjlcx9SR3 xe2A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=Pt2z7YAz; 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 a640c23a62f3a-a6f23fc57dasi166109766b.849.2024.06.11.06.44.43; Tue, 11 Jun 2024 06:44:43 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=Pt2z7YAz; 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 27C5868D846; Tue, 11 Jun 2024 16:44:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8C40B68D6AE for ; Tue, 11 Jun 2024 16:44:25 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id EB1B8C0009 for ; Tue, 11 Jun 2024 13:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1718113465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AH6QNSHrejX+ZLM2ggQHA6sdBduI1iOabFDNq2RW2Ow=; b=Pt2z7YAzJWCLjq3kLoXHEFY2ttOjAWIk17f+7KFmj4B2WbYY2+dfFB7v20Zi4c0sjzu4AF 7uWBHISDMMTEPGY8Pq7/CDtw82RX++K3CILguOluyYiItxPuXRTzt7BO51ges4+iGv+c3x l/d14q5YAduRAs7IWXb12kvFNClFylIMNAvmvugTCXMyRFRCcmHNdkiRLRDDaUkZsvStez zh/Edz0wVMmRDmWG+KizfXIT5ls3HobzSM2eZYE1AqRfc7EA8EXSDQG97ySGYjJymWYDJ6 +bxqtIVaGr8rU4STlEy+rJxLs/VbZrWD73w4KsO4qLAriXlaobKLIfKJJGGGPw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 11 Jun 2024 15:44:20 +0200 Message-ID: <20240611134422.3172010-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240611134422.3172010-1-michael@niedermayer.cc> References: <20240611134422.3172010-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/4] avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds 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: g+pCLWEn+cQ9 Maybe Helps: CID1503077 Bad bit shift operation Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavfilter/af_channelsplit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c index 1c4e815c6ef..43b26677505 100644 --- a/libavfilter/af_channelsplit.c +++ b/libavfilter/af_channelsplit.c @@ -22,7 +22,7 @@ * * Split an audio stream into per-channel streams. */ - +#include "libavutil/avassert.h" #include "libavutil/attributes.h" #include "libavutil/channel_layout.h" #include "libavutil/internal.h" @@ -157,6 +157,8 @@ static int filter_frame(AVFilterLink *outlink, AVFrame *buf) enum AVChannel channel = av_channel_layout_channel_from_index(&buf->ch_layout, s->map[i]); int ret; + av_assert1(channel >= 0); + AVFrame *buf_out = av_frame_clone(buf); if (!buf_out) return AVERROR(ENOMEM);