From patchwork Mon Feb 20 19:29:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 40454 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp2166575pzk; Mon, 20 Feb 2023 11:30:10 -0800 (PST) X-Google-Smtp-Source: AK7set/0nwt44QO9czHHaKMFCF8XcIALgoeKaBaFqYBOsbYR2S1tMhpM6ltYDW3tV2wP7gdW58fG X-Received: by 2002:a17:907:c20c:b0:88f:87f0:c919 with SMTP id ti12-20020a170907c20c00b0088f87f0c919mr12666905ejc.64.1676921410359; Mon, 20 Feb 2023 11:30:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676921410; cv=none; d=google.com; s=arc-20160816; b=DMxAFkTIPM9CXa4P+jZ94XmbvknEGOPRbQnU9KNo4RFsLKVcAn7JyGtgwHBQHgR3RG 06+rSRgfQUrn6GRKJLJBde9mIAgqvGsP2CL9rljPtieMVOEXNqbLW9OiWjh/8Bbv+DET 8G6cFm9spjI+/vnbezZ3jtWq6e5TwwnGInIBE9acGfPpwaC2Ai/LTGIFVFWwy+O89lRd a5bwr73bA1Slxx2T75LiNP045HpoDOwbA2qgrZRHKX3fPt3sa2XXpqiMfU3ecOgAcfjl a7B86/nZwMXZFcFJ37eKMRlPW+4yvP4CfaDH5TVof4Oax2P1KxeXb6wash5rFI4ClchW YiRA== 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=ag1Z7hoMWE4NM6YniLKPiIY5uFx/Yp1J5mOWfXzuz4E=; b=wZfT7Lmtv3m1zIjBiQeNJcn9ho2RuUdrKqme1lx1Uwh86HkS4Gvwcj+oCCu4ELnEDe JUv5BH+2sUQqLLdes0WhKcYi73hNMCkL/2NY++f90sQcL+i/7eOYcwWEvEpfPr4zq/ER XjKM2Ak9F3HwvqVl/Jq7ObuKcPo31+IXDyxBIlwujIayw3S+gUhGnAPRJDSRlYQympDN hjBkWmGb9CerxXy6E7Ce0IUakN6R0+Agsf6Sq2xzZduPzEma8+lhExJLej1yUaajg8Gc D++x/jy/UjLCvB0d49yJ21swFxn2G7rfnfhKxqcsH7zASVaZeBG7e3iVj/snZH3z7VMK uauw== 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 uk7-20020a170907ca0700b00888fddc4ec2si16285776ejc.657.2023.02.20.11.30.10; Mon, 20 Feb 2023 11:30:10 -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 C078968BFEC; Mon, 20 Feb 2023 21:29:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F039468C08F for ; Mon, 20 Feb 2023 21:29:37 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 39764E0002 for ; Mon, 20 Feb 2023 19:29:36 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 20 Feb 2023 20:29:27 +0100 Message-Id: <20230220192929.4493-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230220192929.4493-1-michael@niedermayer.cc> References: <20230220192929.4493-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 4/6] avcodec/rka: check for size 1 filter 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: C4aq0edc1mek Such filters will not advance and be stuck in the current implementation Fixes: Infinite loop Fixes: 56052/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5236218750435328 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/rka.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rka.c b/libavcodec/rka.c index 994c563ffd..7452acf27f 100644 --- a/libavcodec/rka.c +++ b/libavcodec/rka.c @@ -691,7 +691,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns else split = size >> 4; - if (size <= 0) + if (size <= 1) return 0; for (int x = 0; x < size;) {