From patchwork Mon Apr 1 20:56:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 47703 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp979362pzb; Mon, 1 Apr 2024 13:56:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU8hf5Eaf2sfF5lhSBs97HverzbW4Y1L8/hdwNaH4y1QGXeuAgzp33/VctLKBv4OQaZP2FDim3RwKd0LKoof5T0K2aLjJL0BLjRiA== X-Google-Smtp-Source: AGHT+IGlfXwRQNM/GXRLIilBIRkrxmx3xfXm+h6IVR5dQYMCk6p2QzePJJcTi6Vua21kJ229lx6q X-Received: by 2002:a05:6402:358a:b0:56d:c82d:56bc with SMTP id y10-20020a056402358a00b0056dc82d56bcmr5279677edc.24.1712004988534; Mon, 01 Apr 2024 13:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712004988; cv=none; d=google.com; s=arc-20160816; b=q5ze86md5wcLq7md851VI/7cZrd0Preij2Xm7j6VTjo8jU4k0qX/TzV+2yCEeOg9KV zFkfiCwGdnBF6/FKHUWW5xcLN4Pzm+8MaE+h5rnroA0Cwrc4lmjeAYZfrrF13/LaUSRp 5q9uSrJBxfZIjogni/iINg6wkLLKcMlbrQx1trWHQr7sSxNsp2SXotkKPQ4O9n0JbE0x R+1mbKeERYCFtLzL8LSTI7768IKsytrCutxSbuaOWxZoplkZ7A54ekqU5hMsUOHFokhn 1iFkhzMdleuYqpOuPkiO5vhN6UKa0dGw5etCLZLfakaGv4xwtOj2PHQCAazGX2stdt9R 5Y1Q== 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:dkim-signature:delivered-to; bh=M/82+NUzVN5bUd/A7MX+LUQ1T7q06NLr3W1ZKSeHDPs=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=q0YtQPZZzKtlc0RaCiVlqoTlw0ruVd2GPZDlBAYmRVK1DP+0Kvkvh4i6MtsINrbCL0 wMZnygVnxTDkM6uZutVMF+9Heym/Avx3W4sxW9A4zEb06wEdZB9qnu4yYifTQjEDuRwF xr3DetSmkyj6NGbtaCv82tH1o6pkw+og3+6mCPyEywjLG89umGN44N2hqiI97WKK31R7 GRXRwmEWvEoqsXiwJogqlfKeFK68PKza45NDwiG/fnneb0uUYd00y7+R5HOou8S7IsJl Tnhs3EIu/LKrt4S9P5OG8039pYQuwpFYdBqBqAFJp/rytZUSlHmZ2J0KLM4rgTvjbR6K XDNA==; 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=Hguh44f8; 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 e12-20020a056402190c00b0056dc91cd076si2213082edz.392.2024.04.01.13.56.27; Mon, 01 Apr 2024 13:56:28 -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=Hguh44f8; 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 A82FA68CF96; Mon, 1 Apr 2024 23:56:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E860F68CA9C for ; Mon, 1 Apr 2024 23:56:09 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 401DDC0002 for ; Mon, 1 Apr 2024 20:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1712004969; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=NSrJuS28Vq3JAU8SnzWD08kIMGFFF2Se9JvQRlhBrmY=; b=Hguh44f8AaJmt4IoiWHocA6dNIYtEnBcAaa2400JZNb40t3jjKTmYDIgZDSFvWN1lnYApC vc7Rf0SnGoGrhNqb+d91lF94dsJthGezQqA9spaTXrHzkkPLowfEAzKyGm9I1Ay+v/nJRj fLYH6hkRasdPekkajTfi2i+UPzM7glLcic77yECM27lsVSyPLgi1HU/+tvdpcSlhbOKfZc 2MzoqRm0N8Vt/k6twvJ4nEYMF/k932RiOD0aPEMPzW170rDEd6boxt3P7cRmfXO9m2nB9/ dsQFnfhmkge2KhBHKTsnndabpAV303ks40ucebAEyJUlFMDP1QfjB8wYT2QdqQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 1 Apr 2024 22:56:03 +0200 Message-Id: <20240401205607.9093-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240401205607.9093-1-michael@niedermayer.cc> References: <20240401205607.9093-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/6] avformat/mov: Check that tile_item_list is initialized in read_image_iovl() 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: O/GtM3by1k+c Fixes: null pointer dereference Fixes: 67494/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6528714521247744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 7bdeeb99f98..fa4c237c0d8 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -9364,6 +9364,10 @@ static int read_image_iovl(AVFormatContext *s, const HEIFGrid *grid, } for (int i = 0; i < tile_grid->nb_tiles; i++) { + if (!grid->tile_item_list[i]) { + ret = AVERROR_INVALIDDATA; + goto fail; + } tile_grid->offsets[i].idx = grid->tile_item_list[i]->st->index; tile_grid->offsets[i].horizontal = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb); tile_grid->offsets[i].vertical = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb);