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 2B8834AB59 for ; Wed, 12 Jun 2024 22:22:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D594D68D9C7; Thu, 13 Jun 2024 01:22:20 +0300 (EEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 42B1068D994 for ; Thu, 13 Jun 2024 01:22:14 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 4255AFF802 for ; Wed, 12 Jun 2024 22:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1718230933; 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; bh=Zb3RWCQ76LKrBoE/tCeUhll8ZimVDErq6BhDmP1sNQg=; b=p5wXYMn50G7n8aVzmC6jKu+b/JluBxd//kKMV9hdJsi5H6alDx//fIFYdKQI2b6S01EAEC dp88sqCXSHjEn4HfBA/8nItI9VKLvuz9nVW+szi0i/xTEwGA2zSIPZ5iURzXNelAfAqsU6 qCh5XBMOrqmj4PxEhs+C+PEFk7h1dM21Itwg74AI4z+5DrUHMnuSTyVKD25+YD1XYRxwqF 5ePBQrqmsQEVlnu9eMIoQyHnG83cNKUsS/sWe011MmTtzU2J7psu3RbjB/ywIVmS4h6bN6 paBKrVZhujqLfpJW9aWbrhC2Peit6vTr79+ddcLWWo9LLWsb8lUxeBzE/+kvkA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 13 Jun 2024 00:22:09 +0200 Message-ID: <20240612222212.2172147-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/3] avfilter/vf_avgblur_opencl: Use AV_VIDEO_MAX_PLANES 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: Fixes: CID1437470 Out-of-bounds read (out of bounds read would only occur with a pixel format of more than 4 planes) Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavfilter/vf_avgblur_opencl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_avgblur_opencl.c b/libavfilter/vf_avgblur_opencl.c index c00d2f6363c..ad68b8be385 100644 --- a/libavfilter/vf_avgblur_opencl.c +++ b/libavfilter/vf_avgblur_opencl.c @@ -47,8 +47,8 @@ typedef struct AverageBlurOpenCLContext { FilterParam luma_param; FilterParam chroma_param; FilterParam alpha_param; - int radius[4]; - int power[4]; + int radius[AV_VIDEO_MAX_PLANES]; + int power[AV_VIDEO_MAX_PLANES]; } AverageBlurOpenCLContext; @@ -101,7 +101,7 @@ static int avgblur_opencl_make_filter_params(AVFilterLink *inlink) s->radiusV = s->radiusH; } - for (i = 0; i < 4; i++) { + for (i = 0; i < AV_VIDEO_MAX_PLANES; i++) { s->power[i] = 1; } return 0; @@ -133,7 +133,7 @@ static int boxblur_opencl_make_filter_params(AVFilterLink *inlink) s->power[U] = s->power[V] = s->chroma_param.power; s->power[A] = s->alpha_param.power; - for (i = 0; i < 4; i++) { + for (i = 0; i < AV_VIDEO_MAX_PLANES; i++) { if (s->power[i] == 0) { s->power[i] = 1; s->radius[i] = 0; @@ -191,7 +191,7 @@ static int avgblur_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input) goto fail; } - for (p = 0; p < FF_ARRAY_ELEMS(output->data); p++) { + for (p = 0; p < FFMIN(FF_ARRAY_ELEMS(output->data), AV_VIDEO_MAX_PLANES); p++) { src = (cl_mem) input->data[p]; dst = (cl_mem) output->data[p]; inter = (cl_mem)intermediate->data[p]; -- 2.45.2 _______________________________________________ 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".