From patchwork Wed Aug 14 16:49:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 51023 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a746:0:b0:489:2eb3:e4c4 with SMTP id f6csp1051151vqm; Wed, 14 Aug 2024 09:52:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXPcnrBrDNhxJOI8dHKbcDSzR9pzm5P9jYGdKWGy59GOyIgbe0SB2bTHehly+AdpVPsbaspoID0xSFejgcbcV6ZWt8yx4vemuR+0g== X-Google-Smtp-Source: AGHT+IFnyQtAl/JmsaN87TGtoKONb9RMGTOiN8MR26LSK5+7bxIhNyVqOuiJVexC7Nucq7eri4H7 X-Received: by 2002:a2e:6e11:0:b0:2f2:9a2e:c257 with SMTP id 38308e7fff4ca-2f3aa1fe63amr19432521fa.41.1723654351420; Wed, 14 Aug 2024 09:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723654351; cv=none; d=google.com; s=arc-20160816; b=Q151T9dCeRGWE0Fm58mOBbMgG8MEh4B0wVRS+hpsFngXzQThJuCOhI8rJCevMW4n+S JSxABz4jrz0GdT33IOZzIQNw9KQqcnp0QbueGbBG3WA10ENm84QCYF13N4X7Sr506DCh XSl7AHc/qDuX65uFAlNRRb2DfSxrwel0xd0EL0e7QvRo9Ift30Z+m5sa4F2cTXC+ko/2 ZtIqeq1TNTYmyEJkIlzGavi9kzqSk7RK2Eb2q0XKPs5fecBk7y7WjlFuJltUS8GEs5x0 9Tn2muGp7Ll0i3GcMC2peFcgiPWoBerlAZjkvi6Blj1h9HE/zPcoly/QqW60e+/RWgSn mRvQ== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=fCITd2nI83fD+D9/aZWwLJXbKy/SaRSUy24/ciEpkkI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=fwZzdIu9msq3pEwM/FY7Rm5SYCQX7IfSHq3ydFIDTwzLVekDzQdAbioWF/RZuuDnhT pno+l9/X2ovdjYKqB2uiMMnxivQfzPjrjPhZpzH666dm2eCVJYhRDeugGcMim0M9Y26C CBLlGbabbL03EqugL9wO8/+eNg/Ktm3isJZ5gcEVTqIPKppKDZdLxxrEHRc/iKsqQtHj r5kVqJu0S1tt5/W118FL+mYMXqEwwVWeawXEFWrZv6pgifKORwZVwA5ekW4jFEH4OFLf JRaR0JkfsgqDmMnMBlfvWXDlYW7EmuIL/3u/2HkaNlmJF43qWoHRrWxcX9c32KRweRRm aYZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="l6p/BAWQ"; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5bd1a5faa6bsi5362186a12.460.2024.08.14.09.52.31; Wed, 14 Aug 2024 09:52:31 -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=@gmail.com header.s=20230601 header.b="l6p/BAWQ"; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DD47168DB9F; Wed, 14 Aug 2024 19:52:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EE7F068DB87 for ; Wed, 14 Aug 2024 19:52:21 +0300 (EEST) Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-712603f7ba5so1523824b3a.3 for ; Wed, 14 Aug 2024 09:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723654340; x=1724259140; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ZwUvicfFaEDqhx/E8fj722eUaoxxOB+BWpIwyeRZ+cU=; b=l6p/BAWQDM7ds/nLYDaNgHqaeME1TlEHc/gbti0PgZ5fjpNaTI4s+bdPD5K5jaOWPq yLUCfhcWVryVkcwnm03jONNBy2MqfaRiD8Z+s2AzDvJtv9AQWPSLbmN/TBO+LPFzb6Ja SrNCyojGzGMiUDkT8SWLAjU3fJUJmmFIO05B6v2qeir6vekuibBks3M4eRlksUokZ2js ra6xlTb+Rw5emAZ+GPS399V9KD11yY4Us0lsgNjHJY4Si11G+/VoibOUlu0AQb6Yl43R nTC7xV2dv2K4BhyF5HQGlyiaZ5KCPi2oW1qPcFBCf06ufjJQDEm4oDg+MMfaksLQ/ar7 o+xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723654340; x=1724259140; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZwUvicfFaEDqhx/E8fj722eUaoxxOB+BWpIwyeRZ+cU=; b=gQID4PMeiCdrPkS5OI/EO9fGXqM5yreszwBOav3BuFm6yIMtajzftqxkgnjEcVEtnK 6Fw9PHi4jHhvSo4AB0UYs6uE6sHsOtyKwl1l8c7WagRu16mO6XoQOaXkI13n6HnfKWOq 9Jj1AGk88g1qgrEnAMWKld+YoHlqS1Cs1/92nei13c38XSQMQyJ1hsupSj6TJsEvwSp+ TGhHNLbW3wNtjSkVsRGPVRr0zIqo/qD2hNxr6UlVlK7ELjGszialg5wMnY92Iui5t8zh eP8ex3is3aL5puke5Z26Fz29liwwJ8i1igCYHChaTUNK1B+SKPu1//dsK2KJTpSR44ch qT5A== X-Gm-Message-State: AOJu0Yw+VM+r2/qfTsUIb8nN+r+E0B1sUt93nDR0CMQL0MWfc1rBwNaN YOE/XB+DbyWdHNuOEozpkk9LRMJC28LdxfjjThjSyoSSFMxjjECrczWVXw== X-Received: by 2002:a05:6a21:150b:b0:1c4:9f31:ac8f with SMTP id adf61e73a8af0-1c8eaf80110mr4373046637.37.1723654339618; Wed, 14 Aug 2024 09:52:19 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710e5ab56c4sm7531156b3a.203.2024.08.14.09.52.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 09:52:19 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Aug 2024 13:49:41 -0300 Message-ID: <20240814164941.795-1-jamrial@gmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/iamf_parse: ignore Audio Elements with an unsupported type 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: e3dZEJX0LNa8 Better fix for the NULL pointer dereference from d7f83fc2f423. Signed-off-by: James Almer --- libavformat/iamf_parse.c | 9 ++++++--- libavformat/iamfdec.c | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c index 296e49157b..e431f9a364 100644 --- a/libavformat/iamf_parse.c +++ b/libavformat/iamf_parse.c @@ -751,8 +751,8 @@ static int audio_element_obu(void *s, IAMFContext *c, AVIOContext *pb, int len) if (ret < 0) goto fail; } else { - unsigned audio_element_config_size = ffio_read_leb(pbc); - avio_skip(pbc, audio_element_config_size); + ret = AVERROR(EAGAIN); + goto fail; } c->audio_elements[c->nb_audio_elements++] = audio_element; @@ -764,8 +764,11 @@ static int audio_element_obu(void *s, IAMFContext *c, AVIOContext *pb, int len) ret = 0; fail: av_free(buf); - if (ret < 0) + if (ret < 0) { ff_iamf_free_audio_element(&audio_element); + if (ret == AVERROR(EAGAIN)) + ret = 0; + } return ret; } diff --git a/libavformat/iamfdec.c b/libavformat/iamfdec.c index 2e6608b868..55b9d0f89d 100644 --- a/libavformat/iamfdec.c +++ b/libavformat/iamfdec.c @@ -107,7 +107,8 @@ static int iamf_read_header(AVFormatContext *s) if (ret < 0) return ret; - if (!i && !j && audio_element->nb_layers && audio_element->layers[0].substream_count == 1) + av_assert0(audio_element->layers); + if (!i && !j && audio_element->layers[0].substream_count == 1) st->disposition |= AV_DISPOSITION_DEFAULT; else st->disposition |= AV_DISPOSITION_DEPENDENT;