From patchwork Sun Sep 22 21:56:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51714 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d154:0:b0:48e:c0f8:d0de with SMTP id bt20csp2142522vqb; Sun, 22 Sep 2024 15:24:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVEeqoR6j9aKI0/swTXzwSNbxvc30uttSHFyFBaxY5MDm0sro/1FY8Ro6nYLD+sogNSdfwbeh1IzWc1d63xoRjc@gmail.com X-Google-Smtp-Source: AGHT+IFWISh4IVQ+4758mH42pekg4NGn9GNq+EjgQNfzqcWpYJtjCmiPtsGaZX20eM52TiSkvjSC X-Received: by 2002:a17:907:3f9f:b0:a86:9e3f:fdc8 with SMTP id a640c23a62f3a-a90d4fe376cmr466484966b.4.1727043856668; Sun, 22 Sep 2024 15:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727043856; cv=none; d=google.com; s=arc-20240605; b=gAbP1QFXXuUlHn+lbkrqDxN62q4B1/HyRHu1f33N+Uoy0h/xNp/svOr7led0PEJT7q eycfRtWpO39YYmkYwsP8SEntM5HJWAnjSkIs/gfDnhD06g5gvfL3dIYu6RR+yEskjFTd zwS8rWNvpwBSBtF1izU8Wsgr7iGBdN1zCtSUafQhQyEKwMURglSrMfv2B+fK/BgT/+Y9 mUaeVgBFEx3jgN4GNYb8tgqV/8KlM7EacKpRY0P/wpCJrmu1TP1/mcLa6h8J5G/E/pT6 Qi8z2++kI5xPBfu8OJSYCep2mgxgBMufB/XKeWHNNtW4k0je479UXBEgNhLHzMDz8r1d j/lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=Iyqx16OP6PL6jD59/nR7wDmOsihKvy1S5456BaWBkuw=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=iMewlS9dmUZXRPUKkUkh4FwsO9tQKD1Bf0F/Q5iSfffQZiyA0kxW2ZER5Q2V3Dx0gf ptHlqxbHdg/Lx45WLrcIfDuKPvb8SB0KdiANGUI9cGOLlMdQwYxD93STkeetnHjDKyD0 dub1d6tJGBKGSqWbi/+ThoStK9Cp5ya3iu0xXFUfu39W+etY2BeeqVQrNwuBsMIn2FTB Hmg7ETNXgxVj1pTnBqLZ+WbybpSFG7xBl+nHZkund5fdKbDN4LHoDrEeqKZ6Bhxk91l5 F+n1f2fONiDGque+hlNjMexK9ou/2ns8bcKEJz8pE1pmEjs9v5TNshaNmW4AlkV40Qwc C6jA==; 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=Ge7mM0Wg; 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-a9061336b5dsi1265045566b.776.2024.09.22.15.24.16; Sun, 22 Sep 2024 15:24:16 -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=Ge7mM0Wg; 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 0185868DBC7; Mon, 23 Sep 2024 00:57:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BB6E268DB79 for ; Mon, 23 Sep 2024 00:56:53 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 28D081BF205 for ; Sun, 22 Sep 2024 21:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1727042213; 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=Df0uBWh33p/kCzopAMA1T7tCS0It+XtUECjGt5JVQM8=; b=Ge7mM0Wg3Rv7zIV9XZzeiATjBGDRA9vt75VK2+Pv4CkSJOy57I0v5VaYF6KPWiNajjqTwe wYoDKXb7j+T7A/XPHeoAlyahHytQG9p6cFM8N9rxZ5BWDFVYjP/wLglGX9kuWxpBEhxa5P NN8rQtnyHXTR2zmTSdTsL7kOwl/t10Yakr5kKysCpDtlG5qQDUn7HzYTBRpuzUZUjFxPiY tqR84/N6MEYEqALRj8dXseqgUTJFSiZR/RhD8EcMP1miGEdg/Fj6K9/Uyz9feCkFEfmGkx cUb2m4fk7Bw73thdrl2z2cHLqBXYVv3WqzhUfF0k80Yq7Uz49w44C5968m9sFQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 22 Sep 2024 23:56:43 +0200 Message-ID: <20240922215645.1182935-8-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240922215645.1182935-1-michael@niedermayer.cc> References: <20240922215645.1182935-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 08/10] swscale/swscale_unscaled: Fix odd height with nv24_to_yuv420p_chroma() 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: OApafpf8r5+Y Fixes: out of array read Fixes: 71726/clusterfuzz-testcase-ffmpeg_SWS_fuzzer-5876893532880896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libswscale/swscale_unscaled.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index dc1d5f35932..d403c953cc7 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -230,6 +230,8 @@ static void nv24_to_yuv420p_chroma(uint8_t *dst1, int dstStride1, const uint8_t *src2 = src + srcStride; // average 4 pixels into 1 (interleaved U and V) for (int y = 0; y < h; y += 2) { + if (y + 1 == h) + src2 = src1; for (int x = 0; x < w; x++) { dst1[x] = (src1[4 * x + 0] + src1[4 * x + 2] + src2[4 * x + 0] + src2[4 * x + 2]) >> 2;