From patchwork Tue Aug 6 22:18:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50916 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d7b2:0:b0:489:2eb3:e4c4 with SMTP id dc18csp22359vqb; Tue, 6 Aug 2024 15:19:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXUOFJ4fE3Z/Ba4uYXexTVL1GLDXGP4p6IjLJG3IuJeMGubuYoWDRZrdoIOk6+/ifBnC+HgKiowskscDqg0zYhdI+EMb4fR6LaooQ== X-Google-Smtp-Source: AGHT+IHodZEkOs7NeX2SnvrK5Ej6QNrymoxFOiQHDywsJDnILbinAEbfCtXPwBHAATFDYFswMxhy X-Received: by 2002:a05:6512:b8d:b0:52f:c0ee:3b5f with SMTP id 2adb3069b0e04-530bb387bccmr11665686e87.10.1722982767082; Tue, 06 Aug 2024 15:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722982767; cv=none; d=google.com; s=arc-20160816; b=adrg8tmrRjK4lKcydYDcwEYkjxgFWT5CQ+0PmMAmF3HvWv2sLcWrbaOD4NE+fZl1RA 4FedGsvwSLLfS3jvigkdT9Cc2i1dG7mwxah6mLB2iEsaBo0Xi6jfAUl/81TNu3AOJ1F7 zTjY3YEKWMDSklrzEi33+DOplln4Qr6tLEscyAubA6bBejAO8VfUP2ysCOczbMo3IX9H kUeVvwLTZUQpOuzAISYQdkNoJ7GPei9sOKf56Wt+qi7ICcvFgsiehHzKmAzRFcEENRaJ n6TtoM2hPDCH71eVnmc7tjZliC6rnbys57RtahO8P3hZQnLehyut2oto5ZTKl/AtFKvu GAkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=ZmfePXd8ud/VOc31T251PNEXiLX2OZxQdbjyYLOg7zc=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=H2t7wLF2FXFINhqHzb9rJ7togr1CGu0XN76ghSK/Emy6aHRG3rMus03UtvH/AUdSj9 1JFUvFxy3b7WQmTXpTlpRTDmiehJSh0RylGeVDGsqjRdHWvoplhLCG72Ejmy7D2gQrIf jftFKE/mERTYDL2gtQIPpm73ldBdOY6/erm0swiDlczSPd3Pu7Z/tDr1MHQWcch/xhzM /DR/6tvG7eoVaS6uBRv7uDXwfoFRIMS9taRZ4ofc+6+O3maG6cilEg8EA4YBclvKRf2C is2vIlf/4ZY6DCIydpRpt4pocIi5C2NELGtBZdpoaQFKnsliTgfGHv/LXCIqFrFaVlwh HqQg==; 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=eYupvPqs; 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 2adb3069b0e04-530de4bcb40si6511e87.545.2024.08.06.15.19.26; Tue, 06 Aug 2024 15:19:27 -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=eYupvPqs; 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 EBE3D68DAB4; Wed, 7 Aug 2024 01:19:06 +0300 (EEST) 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 4A82B68DA18 for ; Wed, 7 Aug 2024 01:18:57 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 8844AE0002 for ; Tue, 6 Aug 2024 22:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1722982736; 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: in-reply-to:in-reply-to:references:references; bh=2mFgdqci4fSoSrIRovqhsl+F4OIDpea12xQanQU6J7w=; b=eYupvPqsubG1n0BqECR29ZOdYJppluSBcWd90+fc3uJ/Z0YU6JRsLKzqnvZb2CMWfpTgfB 6v20f79fpCKDyhm89o/GNTZRKuvrJLFz8RI2fNheaDiWVyInq9CIUfkIG3uyu2cjmG+d/r XiG8tE7B8ZMBLTq/PXBT6t06xgQTTUFpAdkcEEqVgbawXTSZ8f9K69dxbk69OWD8Y0d1Qz 3ULoCGo0zWOwyJmjo8JxHttV7hMewLLVaTDQ/H/joMCbPHCRI2UOPDWwaK1zrduH9Wtyd6 9cVwALunvVbaLAfDBdlpEKRQ+eKPa2OY2o6A9QAFFLC847IA70tNJM4DfPcntQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 7 Aug 2024 00:18:50 +0200 Message-ID: <20240806221853.959177-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806221853.959177-1-michael@niedermayer.cc> References: <20240806221853.959177-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/6] avformat/iamfdec: Check nb_layers before dereferencing layer 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: eYZkvT5S3UKM Fixes: dereferencing pointers near NULL Fixes: 70432/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5255672845893632 Fixes: 70877/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5348547432611840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/iamfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/iamfdec.c b/libavformat/iamfdec.c index ce6d4aa0647..2e6608b8685 100644 --- a/libavformat/iamfdec.c +++ b/libavformat/iamfdec.c @@ -107,7 +107,7 @@ static int iamf_read_header(AVFormatContext *s) if (ret < 0) return ret; - if (!i && !j && audio_element->layers[0].substream_count == 1) + if (!i && !j && audio_element->nb_layers && audio_element->layers[0].substream_count == 1) st->disposition |= AV_DISPOSITION_DEFAULT; else st->disposition |= AV_DISPOSITION_DEPENDENT;