From patchwork Wed Jan 11 23:54:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39982 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp5132603pzb; Wed, 11 Jan 2023 15:55:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyIlSkv7h4sne0jw6hcU8bGG02PWXOvPFHtNcON4DD8pwRTvHTJP/EMketMX+TK7K3lOAQ X-Received: by 2002:a17:907:8d16:b0:7c4:fa17:71fe with SMTP id tc22-20020a1709078d1600b007c4fa1771femr11671214ejc.45.1673481311663; Wed, 11 Jan 2023 15:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673481311; cv=none; d=google.com; s=arc-20160816; b=iN/ds2Xn6x8tC7bHYCL4Mjtcjg8LTivR0qZTx9hfh1aw+dNjhyMjc1/15PEWXfFpsh ioHGhf9HzYLH9RKqZY9++yIDo30+TsWosOcY3JuoXyl3Lj3lJlpUe3FSwFuQCKVeq7ZN QZhsYBu2ZEARWeyAUnyOgA0MQSir8DtjsuNowl23txJqxvvr3j+pQE1opy97x3DRDlAy NFnzODyAYiGyF4492rPpHN+fgG+SrjzEWVyysOMKz2QfiY3n56cwn6P++E9yayUolvdQ ygNDoyG8Q56cee/z3cC8j3sXdPFhXBqdm6Co5fdoRjnxJQ7dU3pMRMg/QRHYTM4yucad NNUA== 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=hYXceapQ9goyBgSf2ExdLFcPf++XAUiXZ8zJ89qLS5M=; b=s9JPgJdFWMdia5jS9ihM6gYzZm6oNywB9htAzjGJ06SWT9nA41nhHmVURBPUAwL2D6 A+Qf+ndhJf5kiI/kdkxf7Ec0o1DqsBwkwvAUqyGKiuOZBKp9IV3ZFbs6UP5CUWMNECE1 w6XqrlDkVVOZmPcrLcBKkjcBheOWRGtu9Yk52tTc7yBwxFPwb1jU0b//K7aE2XmSJjsx XHozj0eW51znQG6ixxHZ2R6UVJ5FiOGXS9MeewNmvajZXh2NohPfRuIaKNS6xdzM8L0j pwdjx2Shn3nm2tMavLDooxc0/3WITUUoljmEXQ/cV/pO0r8qXh24CutnfTYzcLofQsfc BWWw== 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 xe9-20020a170907318900b007c12a22dc43si15013696ejb.662.2023.01.11.15.55.10; Wed, 11 Jan 2023 15:55:11 -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 481EB68BD9A; Thu, 12 Jan 2023 01:54:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29DC268BD39 for ; Thu, 12 Jan 2023 01:54:37 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 7535320005 for ; Wed, 11 Jan 2023 23:54:36 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 12 Jan 2023 00:54:30 +0100 Message-Id: <20230111235432.2135-4-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 4/6] avcodec/sgidec: do not forget the number of components in read_uncompressed_sgi() 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: WEdtc/WFrjS7 Fixes: out of array access Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGI_fuzzer-6704753329700864 Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGI_fuzzer-6683986844057600 Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGI_fuzzer-6697387691474944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/sgidec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index 6ff2ee97f6..92083f23de 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -159,7 +159,7 @@ static int read_uncompressed_sgi(uint8_t *const out[4], const ptrdiff_t stride[4 unsigned rowsize = width * bytes_per_channel; /* Test buffer size. */ - if (rowsize * (int64_t)height > bytestream2_get_bytes_left(g)) + if (rowsize * (int64_t)height * nb_components > bytestream2_get_bytes_left(g)) return AVERROR_INVALIDDATA; for (unsigned z = 0; z < nb_components; z++) {