From patchwork Sun Sep 1 13:09:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramiro Polla X-Patchwork-Id: 51290 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4027:b0:48e:c0f8:d0de with SMTP id ky39csp1334770vqb; Sun, 1 Sep 2024 06:20:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUKWrMDBLQakOsmsKF63AVzfnxV+9sFKNt/CXwYhuEVDp5oLy/WxXdRPBP18UOcyjKuLepTE2qjsC+6hmrFOO31@gmail.com X-Google-Smtp-Source: AGHT+IHXb23ZOQN+4Z2/vk4Y18QsgFZBuq7KVj6aQH4N2zLja1jcsM9BITCu6ZPOPUzR24my8qCc X-Received: by 2002:a2e:a983:0:b0:2ef:80:a68c with SMTP id 38308e7fff4ca-2f61e0c610bmr27166611fa.8.1725196813399; Sun, 01 Sep 2024 06:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725196813; cv=none; d=google.com; s=arc-20240605; b=MIFOoeeNIfcRdjHlhnru/aTEMBB0Xlyxf/84mCs396BFSF7zEXKducJuUvoZJkAAmm 1ZKpjaldFptAZ+zknyGdjJxAW+AJ+zKnxXs+LWENvvzF/ggWfYzoLz68tc6M5Qm7ydf7 F/4vw02K7Fkbql8LJstekAMVTA23wfHBjaP4/ghJnpHentrAk0qtS0nn0RY4fK4gYLhC KdUVgB8Q+6k3nBxzzbIbKIDmhw8/XL36MP5N8GP/CQ7/HdtSI/L0qSfmw6mc72wiYIp6 JtZaczDSphDyT8QlcRHQRp0QT9e1QOxnojba2qrqQ/HUlcl8CjxsnEO+NMJjJuH1o73K 8NDg== 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=Qj7HJ8/NE0LTsfILtesPV1mtSjD1n+ZnTpCtWL/g7Q4=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=cEfHu38VcPANrKmOSqsMT/GvgWeM5k5UjFFMqI7+rvyRE+EPRQ6frAWXSV11s7qvjd vGgM4ja7HaS+xtPDhxktM1pb+hVY0P5AvuIMPEso/oO47JHqVHGYGnlVedPiCLmOvS6F y48OZOSiljvvNxekyBjP4BturW5YtE7u1PAuJkjHtnJqV/2+OdJX7j2C8A9Hi/JFia3K bBY1Kp3TftPvG2YtW+ecdlpx9SWL7Hv9BNtTxYdQFsG0okW/jKbPiPutgw+nsV4aXSb3 3Cu/hijWjM5IFn/5b83ZmQakYJa34REfhgifFmvK91kQBkdMMIZYKjiSRZv1Hzf+Ny6L 6jKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=T4jJP2CD; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2f6151834f0si20442481fa.570.2024.09.01.06.20.12; Sun, 01 Sep 2024 06:20:13 -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=@gmail.com header.s=20230601 header.b=T4jJP2CD; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7D80968E082; Sun, 1 Sep 2024 16:09:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ACB4468DF1E for ; Sun, 1 Sep 2024 16:09:39 +0300 (EEST) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-374c3eef39eso528387f8f.0 for ; Sun, 01 Sep 2024 06:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725196179; x=1725800979; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/I/RyvlNFMDlt9yF7wNbw+LrmFwgkTGe3pYr1Vt3xWE=; b=T4jJP2CDkdpcGelnyw58RuF6Hgd47xwG5iNOv9qAHmpZCGx6NEjkDTMAMkXo0rwliJ cHgp231MrHGOgDu8bBb6OXE8SXvE+R8MSCMd72/FMfHYSmFni2YCsKoAh3W3ZXZ8KtNj SyBQllnNlM6VbBwRb+Wv4VSen4BYvN7iflys82vVDE4BdekARjxFOzruKJgj0F4rEkOC p8wD2ByIThHqpqRb45B9zhc8p+fyaNt0fPGTvZdDcPyNs+YgEoDVCXOBvkUDWJbv9srx yfrIG/04u/Mq5g9ZLdcXiZWfV5L1bIebYjuL9vlwHVqSVdLAS8Au+YZMn8b4yEzW/fvd IjWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725196179; x=1725800979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/I/RyvlNFMDlt9yF7wNbw+LrmFwgkTGe3pYr1Vt3xWE=; b=pIuUHIUEqq/CNryqSFmBpDa+yUYyKcLvvCsBgM/uWqHse2ok+/eMs4dGb7Jr8IkapV TB7Vv/gxHp18TPqI0TuKtZefMZ8MGpWJ98R9DGiOr3FJwn/Ox0HF993m8IhJTLrWnlXZ D0zFjlNhHxDOT/E9zrBvuNseM5juByHsGNjw6b4ylbnbi2QZIeuTovwUng3IkjwvfNPD C3H/gIyHGv5jlHlmBqlW0UQq3NXix40cJy30npK/s7TD7LVPu6ttzUy2soonGJVNLEbI dPa2Xkg0FEQ63IWvcp1DxlKNsaHP1DjSItI/35gPoH2w/H5ExZ5BK/QuMCOWXLf9/dK+ kJBw== X-Gm-Message-State: AOJu0YzD100dllLmW2jAFmjr3BncIb/dkhnlrD4dGGxPqoeHq26+JwLb VnaTblibgNOJrzktOND+zxXYiX9FnxF+GmM1EaPIvlwTvE6K9qwK0bjwOA== X-Received: by 2002:a5d:5f47:0:b0:367:9575:2820 with SMTP id ffacd0b85a97d-374c94714f2mr809343f8f.45.1725196178456; Sun, 01 Sep 2024 06:09:38 -0700 (PDT) Received: from localhost.localdomain ([109.138.158.185]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3749ef812cbsm8949411f8f.83.2024.09.01.06.09.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Sep 2024 06:09:38 -0700 (PDT) From: Ramiro Polla To: ffmpeg-devel@ffmpeg.org Date: Sun, 1 Sep 2024 15:09:34 +0200 Message-Id: <20240901130935.5887-2-ramiro.polla@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240901130935.5887-1-ramiro.polla@gmail.com> References: <20240901130935.5887-1-ramiro.polla@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] swscale/x86/rgb2rgb: fix deinterleaveBytes writing past the end of the buffers 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: 1FU7Yri72F7g --- libswscale/x86/rgb2rgb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index 4d6ba9ff21..1617c33338 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -2380,7 +2380,12 @@ static void deinterleave_bytes_ ## cpuext(const uint8_t *src, uint8_t *dst1, uin int dst1Stride, int dst2Stride) \ { \ for (int h = 0; h < height; h++) { \ - ff_nv12ToUV_ ## cpuext(dst1, dst2, NULL, src, NULL, width, NULL, NULL); \ + if (width >= 16) \ + ff_nv12ToUV_ ## cpuext(dst1, dst2, NULL, src, NULL, width - 15, NULL, NULL); \ + for (int w = (width & (~15)); w < width; w++) { \ + dst1[w] = src[2*w+0]; \ + dst2[w] = src[2*w+1]; \ + } \ src += srcStride; \ dst1 += dst1Stride; \ dst2 += dst2Stride; \