From patchwork Wed Jan 11 23:54:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39980 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp5132508pzb; Wed, 11 Jan 2023 15:54:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXtwsJYe2A/NWrv8m40T6Oj3vFsfU2q06Uf2R2IHJ4Y1DB4Aa5snB4IB0KCOVvKT+aSTQlLA X-Received: by 2002:a05:6402:1944:b0:45c:835c:1ecc with SMTP id f4-20020a056402194400b0045c835c1eccmr73402256edz.26.1673481295832; Wed, 11 Jan 2023 15:54:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673481295; cv=none; d=google.com; s=arc-20160816; b=dVjw4ZtoyObYKYtfHMnqqUorwOyJo1nfwxIiBie52sPWcauDLGD19xa1qAbDtPF/hR jRezr3hwimstLIJfzqA4E7Y3BrX16K9dAl3/F+do8dN6qPHLvgHG1kudj2SHVc8rz5YY 9VTpQacuXK14JgTsXoOg14v7zUa5DevbwdvsbNyxzQ9aQZU0bwKOjpvdJByk4dd3f7/c uY8cKzhnYrYYdgAMM1uNzS9S1n6fMHMGXxJIpIxcmlbplbChyses+jp+7TOi9gjb5766 /f/mNxLVYKevt8wIxle9G3uyJySQmAO4lmifEgqG/1g8MF/Qm5ip+S9h3lIuHEMlr5t8 gAdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=4Dnr4pvCKGdHaLzi7DHyY4FzYRg4yfnXEI8maPx7EAc=; b=BNfRgQSQabt5ftoq+xiL/Eyu1u6dJefI1W0mraWuFnTcDisKXMPSu4gMGakixDUNyR eZCUAcGYzhHNW9C0UtKenT2DRfA8svcJax6bsxa3VJEIKZEOG235zGC7tK9yxyRk2/HY pnJx6a8HFcl2ARtyQrUbKrLXr1yIw/VbzHP+xrO6KfAxCTNpGxi9xbuxaMNdqwaDhn06 jx61n+IabBOgFc41JNB14cKTM/hs1Fn9sP+ofxFolmYy+cy3bs6kOdC90F5cQ1ixJDWe gj4HjdOb/FnmyRqH2f8fys8g8eIcl0QuZhbPutyJHD0+Uu56gLh5RfJjjFAoeMk4JIXz y5tQ== ARC-Authentication-Results: i=1; mx.google.com; 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 u9-20020aa7d889000000b004861295a0b7si14844145edq.332.2023.01.11.15.54.54; Wed, 11 Jan 2023 15:54:55 -0800 (PST) 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; 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 15E8268BD60; Thu, 12 Jan 2023 01:54:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CD81168BD08 for ; Thu, 12 Jan 2023 01:54:35 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id A4418240004 for ; Wed, 11 Jan 2023 23:54:34 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 12 Jan 2023 00:54:28 +0100 Message-Id: <20230111235432.2135-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230111235432.2135-1-michael@niedermayer.cc> References: <20230111235432.2135-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/6] avcodec/pngdec: Check deloco index more exactly 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qF6rwNz4oqZA Fixes: out of array access: Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PNG_fuzzer-6716193709096960 Alternatively it should be possible to limit this to 3 plane RGB 8 /16bit to ensure the size is what it should be Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/pngdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index f1cad26c52..cb4162d2ab 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -322,7 +322,7 @@ void ff_png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, static void deloco_ ## NAME(TYPE *dst, int size, int alpha) \ { \ int i; \ - for (i = 0; i < size; i += 3 + alpha) { \ + for (i = 0; i < size - 2; i += 3 + alpha) { \ int g = dst [i + 1]; \ dst[i + 0] += g; \ dst[i + 2] += g; \