From patchwork Sun Jul 7 18:47:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50396 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp5408804vqv; Sun, 7 Jul 2024 11:59:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVznb/lejggtQDEPha3rDoPmqJmNLw1eSbNDz4Ij9ilhOMxqmSr32VMpfY8Ht3jFJt79FgLGUvEWduRrVHr7AxGJ/o+DfYrNo379g== X-Google-Smtp-Source: AGHT+IEXVCAh8TzEgwFXnxz23ToC/V0XPVUMc+XAQGve6tA4F49CwLc3G2XUSElZryMo+P3c69FO X-Received: by 2002:ac2:44d9:0:b0:52b:9e52:17f7 with SMTP id 2adb3069b0e04-52ea077c2d8mr5073078e87.6.1720378749090; Sun, 07 Jul 2024 11:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720378749; cv=none; d=google.com; s=arc-20160816; b=boZ9mp2FZ1afrUkI7REmfq6KNiTRWOL3gY8bGfpnd1iy2pdwbJDHNg/kM+R+98om+M 5p+bT0Jd55cmWoHvnEiGlGCbLEjVLzq7agcf+TLKytEcFhEh4xMyKxN1XlCIn8IGHYbS Tqhzv5ZUfVOeA+Q82fdudbjkvwu4b3VWnmQTTPn0N+/atgwMw0aWFWGvSepPXmKiUsgG ehvag/ydQ7h7nyb+Z8PI3rvrA4ADXlVCpdvBXNLsen075SqchjhqZnmJBB25XIZrtdDf +e6WXYfMfDlLPK/3WBS0JKKDde/RynTqu5SYYBETwu/T2MM2J4iw36g7o0VAX+XhVjWH pJIg== 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=MGh72e3brQlEv89c/9Vmo4vBnMhmK+qQGN+1xVNXmgw=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=zEn1YGY7KXfdzKtHaCjyLRxbN30+lOOUEX7/jrSZcN0jxBW+mLZZUeBwHroDJexZem lego/KJw/Dfp6XzI/6MBBVLfOVYpVYB1UDRYfTuQwumckk+u1V3EiPplURrl01/+I3xY KmFsD8G1M6XAGADMfl4uAVxY2xxPNlz7FTOPJ+hQQboSQLQ88gIvNZ4SSr1Q79Fn9sgZ CvmjNtrB2Esxwo3v/KddO4QlszCss4LpT0JW7iMLZtdy8Na2yciDc+KkA1juS0CnGqzt sGCy+FVk7Z/QcEnrgCrAal4MKwdwXdvB/hd437/NrOV4WK9/4XPKYkig2nXTnwj+pimn dR8Q==; 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=Z5WS5hpL; 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 2adb3069b0e04-52ea21877a2si2321845e87.408.2024.07.07.11.59.08; Sun, 07 Jul 2024 11:59:09 -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=Z5WS5hpL; 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 CA23968DBF9; Sun, 7 Jul 2024 21:47:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E8CDB68DBA1 for ; Sun, 7 Jul 2024 21:47:34 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 54F85E0006 for ; Sun, 7 Jul 2024 18:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1720378054; 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=jR37XGJgjnIcivtR3hpF2C+1pOFogKk74xdDab0ms/k=; b=Z5WS5hpLNUnaV62QYBdJTZdy7ZG+U/jLAi2rAwId0KihdoleR3pE6iJ6O0Spw4STeQzDI3 jXfKXodApIy04YIGj/tIg2wDIa4HnXK2YQjYbTck1NxRcncIz0yZTJeIuBHF8i10dYMqQ3 CIyPw3jFvZX34Uy45iOQOTYiDAl7Tragt9a5Yrr0tKpWoSrxbBcQRRaXIHLCucKbwlJep4 uHUbhg3syJGvfEeHAk6FGln/oeBf+nCWX35T+UvLRjbld37KPm1KQzpn0djKc8EBRGEZFZ O2Aq2PSbL0CMOLG3mCDeIQgYSBIP+Uo29qldDfp56H5OE9KWJi9AmbYJJY79TQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 7 Jul 2024 20:47:29 +0200 Message-ID: <20240707184729.3525852-6-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240707184729.3525852-1-michael@niedermayer.cc> References: <20240707184729.3525852-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 6/6] avfilter/af_surround: Check av_channel_layout_channel_from_index() stays within the fixed array used 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: sHRCzum90B0C Fixes: CID1516994 Out-of-bounds access Fixes: CID1516996 Out-of-bounds access Fixes: CID1516999 Out-of-bounds access Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavfilter/af_surround.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c index e37dddc3614..fab39a37ea9 100644 --- a/libavfilter/af_surround.c +++ b/libavfilter/af_surround.c @@ -269,6 +269,9 @@ static int config_output(AVFilterLink *outlink) for (int ch = 0; ch < outlink->ch_layout.nb_channels; ch++) { float iscale = 1.f; + const int chan = av_channel_layout_channel_from_index(&s->out_ch_layout, ch); + if (chan >= FF_ARRAY_ELEMS(sc_map)) + return AVERROR_PATCHWELCOME; ret = av_tx_init(&s->irdft[ch], &s->itx_fn, AV_TX_FLOAT_RDFT, 1, s->win_size, &iscale, 0);