From patchwork Sun Jun 23 23:01:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50105 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:ae71:0:b0:482:c625:d099 with SMTP id w17csp1693164vqz; Sun, 23 Jun 2024 16:02:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWRNkYSYBdrrG59d7B+6/XkQSRYg+W1Sm7H+Xz8ClM3/zam/m1JkI4S1b++ShzZiAMC6LskOukQX6uz9PfSMdbP9o14LqfHdcWwBg== X-Google-Smtp-Source: AGHT+IGj7iskgxqEKHJTTWbnBK1aFKgmzQwdMDUYQyo0dy/R18eG0e2frcKgEhbLvfiGJrJbBpg2 X-Received: by 2002:a05:6512:48d2:b0:52c:dd2c:b8be with SMTP id 2adb3069b0e04-52ce0619953mr2414388e87.19.1719183746451; Sun, 23 Jun 2024 16:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719183746; cv=none; d=google.com; s=arc-20160816; b=CNVSLYyVGv66LVIDlrDo//YdUcVW6in1gLl9m6cVSxAW1vo+hAdc3XBFCS30CI9A4x j0VxiX/FuVdhjMQ0R5Krxvf6t0FT8ESpggg71Sq//c6vkS21+IYq6IV0bm/g1gMQYq8M Djh602dr7hb7Hjr/bYUM6s36kAThmEBVH0gJyB936X8hRABMANeRlSr/NVItnslPmMzN A+X1S+mzmlF1oCs5Xit5TlKqqS8KZLZR3qEPBxDnl/VYphyH6IdZ8pZeOwkAEcNNZfYS NSMGm9HZvLwg3Um3aDuQ19xp+RBRt4Yg5IfqP5dsahvAFUpp7x2pZnMeul9vntLbT+P6 iuTQ== 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=blx3jZ22bwsqAxW9/UmS11vJbLnOJwiAFImaWVkQhig=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=WNr5C0SjtV27DxIIiPrccxwwnxpGAZUaMYf7J60tR9gzatl1w02m/eH6o0QDdEGuoN rAIZTnEVGejPCiicRcRXN/lNQh06NShsj867zEl9lK43RRqZFGOmQnGGG5gMcBGE8oC+ Ziq1AP5WXaQUJbMNeWbHjB3iDaf0OiXuT0MpA4Q0c1HYrehceKSiXPwTq+RBBh0X6SqH pvWdB7oWXgr05bxspcCG2Er0fGD1wI3FjWkG8PK2pAUieI2E4UAVcgXqP1t9CeTUt24X CRJ/KqkjYaO1shy5o+tSdw+52uB9cM85VwEgGe3Kb2o2VUB0AAQjrfPje2mQKQhSMIBa p+qg==; 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=pqhHEun6; 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-52cd63bc04csi1783827e87.133.2024.06.23.16.02.26; Sun, 23 Jun 2024 16:02:26 -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=pqhHEun6; 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 B82C068D62E; Mon, 24 Jun 2024 02:01:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 54AA868CF50 for ; Mon, 24 Jun 2024 02:01:43 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id AEDC81BF205 for ; Sun, 23 Jun 2024 23:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1719183702; 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=lOgBhVLruIlJ6x6FOPCSf/ljRUOba1vvYuSlniB1mGs=; b=pqhHEun6rj3bCq+OR1OzXddtLAirjvJb7UdYMQb8sgeR10g7EoOy5AzVZtMKCWSUNbs5LF VL7wAXYNs0l8D072wqLN8oI4XktSoTIVIZyHn+dRPAaCVLJBbJ236DXwFA7H3A4w/R4svq rkeZpb3fZpgYgfPTx8F6J2LzeiAXtit7WjqbGA2vsoJP8Hf+A64P+dCugWzE37MhOKvADT rjiOBDT9KcYuwTLzFxqWedSzFcYKmQD7eG2YsgyELH5105Ee01W7yVuLus+kT+EXrnG07T W/YrB6lVCO+AMnqmUfHGkeCtQe+opFOgnupF130JWSYToytsfSrP9/tABJjxew== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 24 Jun 2024 01:01:37 +0200 Message-ID: <20240623230137.1749178-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240623230137.1749178-1-michael@niedermayer.cc> References: <20240623230137.1749178-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 5/5] avformat/iamf: Check substreams in ff_iamf_free_audio_element() 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: RJ6akbR8X09U Fixes: member access within null pointer of type 'IAMFSubStream' (aka 'struct IAMFSubStream') Fixes: 69795/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6216287009701888 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/iamf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/iamf.c b/libavformat/iamf.c index 5de70dc0828..364cb60e021 100644 --- a/libavformat/iamf.c +++ b/libavformat/iamf.c @@ -74,8 +74,10 @@ void ff_iamf_free_audio_element(IAMFAudioElement **paudio_element) if (!audio_element) return; - for (int i = 0; i < audio_element->nb_substreams; i++) - avcodec_parameters_free(&audio_element->substreams[i].codecpar); + if (audio_element->substreams) + for (int i = 0; i < audio_element->nb_substreams; i++) { + avcodec_parameters_free(&audio_element->substreams[i].codecpar); + } av_free(audio_element->substreams); av_free(audio_element->layers); av_iamf_audio_element_free(&audio_element->element);