From patchwork Sun Jun 16 23:08:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49966 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9196:0:b0:460:55fa:d5ed with SMTP id s22csp1609554vqg; Sun, 16 Jun 2024 16:19:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXGLWf+BkaENd9bmexzMfumJNnt1WiG02yAruaX4VKztKPsErt+75oUkKRlltfnW2da95NI7HYV44+oJd4GXply1UX34d2rc5+npg== X-Google-Smtp-Source: AGHT+IF63XJfMKm4Bxgg129oTpLXYlzMMP1Gjdvn+TdfKwx469njQSXxtXZj/GGH79nS53eD2EV3 X-Received: by 2002:a50:8e44:0:b0:57c:c18f:8ee0 with SMTP id 4fb4d7f45d1cf-57cc18f8f52mr4422610a12.3.1718579954501; Sun, 16 Jun 2024 16:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718579954; cv=none; d=google.com; s=arc-20160816; b=rI4ZMLUz1IU7gd8hSzKUJM/HUq9g8N7s9oDoRu+ab9VX1fkFLm7fgiAmN91/XDK6yU wM+SIlkzYNjuMDVGoA88cGZ1QIW34YezSlfH3FPiyay6nQslHB9BPYRPyA10ahzZhZaV Cia2QwThJ0c9ZipDVvL1UnMKaTeCv2g4TrHFXfNpAllh+3u9TGhrHx+612Cwv59hfRpw Gz05FLspZr+nvVZf4qkcO7E8sg1hyeAU7ZEaH15qD6iLxSe8CWx1iG/n5Xi2mc2wLjTb iMM72HN8fURIp1w5FxJ+r6a0S4ADWR6WhDl3/VRO3EUdf1xL++NhoTDKqLsJipRHWUar kofg== 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=KzVBMrTzCZOVbZlgW6Wlj2XWVHPMn3fKk8zpjVHdwc0=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=fLzt4uM3TFpr4A/zj3JPySFEwGTv4i42u5Svayjjz5EaZyc7p+rSTeS4uMqZyzITVy M0vilWfFyUdSd5eo5mawn5b2tZrA2EiOuHi6DGb7nLamDDP3RRAa4iY+WkAdpcyyZEid MejIkkQjiVxuThfrW+6OIQu06P11L4WcIVOa5T03p8lT6Si83Y09i2qAMA1uB2ajVFoG nhr3ELVgfhHjZnxoB1gFbmdLbmR7ZoSoaDGiHgXD/qGDdx0IDYmsi6bkctdAXTQHOpbP uqu8t2nVYXq2da4SYD6F4zAxoVOQmPojaWxDn+YIizpGfjXnLatVB2/oFoDTrA3lIY4F +ohA==; 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=Q6VHrjpe; 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 4fb4d7f45d1cf-57cb7461f2bsi4066004a12.611.2024.06.16.16.19.13; Sun, 16 Jun 2024 16:19:14 -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=Q6VHrjpe; 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 B865E68D754; Mon, 17 Jun 2024 02:08:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EE6ED68D72A for ; Mon, 17 Jun 2024 02:08:35 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 26FF9FF806 for ; Sun, 16 Jun 2024 23:08:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1718579315; 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=SE9MdkIqjlBcwyQ06mlKRK0HPgeqrXuJtab3l2ITGP8=; b=Q6VHrjpe5bpRp9VAAUwKH2p/Fa+L4Xp3mkwUpJ1mGnf/7S8nWMINR51mVkbyTLtxpmsDFK pUMOkMbIO3uBS7u5tCHHxay4dOLNOtGTbzE/pFi2poc88mCXplDr/j/NHkEYVB8GjyEFHx 3dxRqE1BTWIGa3Aviujx7aXGTuMWBej9kHGsujJQTMBSL4jaycn0NxxSwHclo9JjH0ZSrD ujoDnceL8nHS9CCSaCugx1D2jimhYTtGsb9cUhOnYJwcyn1nnLmytxwkix0NO6YyuUZsrf 7lyIFJvR7/4e1QBu5/GTpKwH1lYmjZNP1g+F1nl3qo9HUx0UH/rKFTKvQLF60w== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 17 Jun 2024 01:08:25 +0200 Message-ID: <20240616230831.912377-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240616230831.912377-1-michael@niedermayer.cc> References: <20240616230831.912377-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/9] avformat/iamf_parse: Try to use less space after the array 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: TVF5+BrGAppa Fixes: out of array access Fixes: 68584/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6256656668229632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/iamf_parse.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c index 312090b247c..5c2ff6862a7 100644 --- a/libavformat/iamf_parse.c +++ b/libavformat/iamf_parse.c @@ -355,6 +355,9 @@ static int scalable_channel_layout_config(void *s, AVIOContext *pb, substream_count = avio_r8(pb); coupled_substream_count = avio_r8(pb); + if (substream_count + k > audio_element->nb_substreams) + return AVERROR_INVALIDDATA; + audio_element->layers[i].substream_count = substream_count; audio_element->layers[i].coupled_substream_count = coupled_substream_count; if (output_gain_is_present_flag) {