From patchwork Thu Oct 10 00:18:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 52171 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:ac52:0:b0:48e:c0f8:d0de with SMTP id x18csp27267vqg; Wed, 9 Oct 2024 17:26:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUp6Bj6kkupP5+43QAQiiL3Ejz0tEDYxYbjdk14BZMVXjjDyI/YoIFP8KaU9RM6ZCajOLK4VdwgDOnzUaP334M1@gmail.com X-Google-Smtp-Source: AGHT+IGxu/V9A0i4zhPYkF7uLzHLpbMZW9gpfPLctzQhvaJBIsTBzpC1nOeZeuRmZuRufwrcLrC0 X-Received: by 2002:a17:907:7f91:b0:a99:65c6:7f34 with SMTP id a640c23a62f3a-a999e628d1bmr155469566b.7.1728519970612; Wed, 09 Oct 2024 17:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728519970; cv=none; d=google.com; s=arc-20240605; b=IgcySsyAt4oI1Ax6d4a1Kff6Cs3ZeR/ADvAqJZszDq83l53IDNJ3MTjVvHX5+w5sX/ fcmLr7b3as7xtsenhpO75uSotPEJ8RiS3NKZeNMGgJsiK8z376PfPwPMBcVQgcMhjnrE 69CDgQILlcXxBKDtAsCaFac3S4voL6u2P+PYqoAgFBfPlzm8rzxLcEAfg/BaT7XJsfPl eyy9HpR5KNdVtk2yqQbzLUD7XLi+U9Cb0irg+xMARDR6YD9r+5UOt1IFy59+R95/0BrH RRerdrXbf0dtWtzibvFS0A9s2TL9oMGupBZWrCRS/84s7gUOcFZbbP4L00CMUi6EaSqu +MnQ== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=+ggRIiwz0SXxAeU3veNkyQ6cqQAuEega+2TtQ1pDuHs=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=lHFnxgCPPW1KpLoj5Sxaj+ysHikECd4VQC34AJVTwIVPmK5YKnzsYZiO2QYuwW3Izp EWxywARebIVzuHqvaYiPrE/rbmFsHhzZ9ugZMwtm4XmmpP2UmBX6QNK6mHRmLa1gNjcQ 7lN3gh2qUaLNqI7jrx3/obRTSKAbQwwmGFXLIn3liZGZtLh144VqooJXt96klmWbRSI9 l+hZJtWTtYS2wWrQPnyl64SNLjwnNxOiwQBh1EtfWiC7z8INgnvWaNvZwAhMkTRjnuES THwAbJWw67TllOUuxO2QCGS8q8vtKoU/rbNOEyLx+yd04JDZpZPe3c3It3cdM/4rxDQ8 hjkg==; 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=liHqmBHL; 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-a99a816d052si3699966b.1014.2024.10.09.17.26.10; Wed, 09 Oct 2024 17:26:10 -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=liHqmBHL; 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 8664168DDF4; Thu, 10 Oct 2024 03:18:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 01D4468DD14 for ; Thu, 10 Oct 2024 03:18:33 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 34E8C1C0003 for ; Thu, 10 Oct 2024 00:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1728519513; 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=80AF+3sjsLuieCI37CcUtCT2xwuQiPP1gVzdsDTD+VM=; b=liHqmBHLT4hNtf9i/dkvAnasNPVoW6qzMeDFYoCvkAdbC3EWxKqv4DIEZu8/l+I9OIxFIK FsFqadd31RPeBVckhuCVzotHir9mW125JeQIom/w8MDykjPIC7HkwEb6C+TpPN/4awTtQs WKeVNeb29QIQnkVX8crQMP59gLpjseh9ZrhIwU4iLZnLLPslLNtRx+h2O8V13VE6RBJmbn ajCqy5RWuLYNhXwjpI8Ahz+PgucElGUN/Wypv8sWPiCxREV7S97UmZK1TBvZEo8xkh0HNx I1dILxgc4ncJUDUJv1xQ/InSWNVsmuub4m9uEyfWDwbCfk7QUE1EKgLmRvi/cA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 10 Oct 2024 02:18:28 +0200 Message-ID: <20241010001832.1120712-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/5] swscale/rgb2rgb_template: Fix ff_rgb24toyv12_c() with odd height 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: 1031C1eCPt09 Fixes: out of array access Fixes: 368143798/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6475823425585152 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libswscale/rgb2rgb_template.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index 197450169a8..84b9da0911e 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -640,7 +640,7 @@ static inline void uyvytoyv12_c(const uint8_t *src, uint8_t *ydst, } /** - * Height should be a multiple of 2 and width should be a multiple of 2. + * width should be a multiple of 2. * (If this is a problem for anyone then tell me, and I will fix it.) */ void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, @@ -659,6 +659,11 @@ void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, for (y = 0; y < height; y += 2) { int i; + if (y + 1 == height) { + ydst2 = ydst1; + src2 = src1; + } + for (i = 0; i < chromWidth; i++) { unsigned int b11 = src1[6 * i + 0]; unsigned int g11 = src1[6 * i + 1];