From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id CE4B44F7D7 for ; Mon, 23 Jun 2025 12:44:17 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id EB0C268E12C; Mon, 23 Jun 2025 15:44:12 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id ED5C768DE34 for ; Mon, 23 Jun 2025 15:44:06 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 4F08642EF2 for ; Mon, 23 Jun 2025 12:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1750682646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+D41Pn3dRJfPQLFFU7ViEn+cr8Xur1gUR86Im+n2wtI=; b=WvtMa7KT6NusX/IWAnaFKA6KPQrtp/8qDQlLbb52Nd2t1lzVPb807f2QCCoJZI+rDBusbh CrT8+4mepYrHtLYW6MDTiCkIIggNlbswdhFeDEpKX4qX20akyQ8jPK30sq+rKCe8jZLwSm X6T0KQcceD8kgq1kp/IxSNusTNG295pFvQTSEC9oQ+K9ZFaofcbqO5CXJTsRKvOROqAspr PB5JHtR3wBbjbwfHeTYgcq3fHdc6ik7Jwh8lEgGjGsqNgSRpeQPO+Lf7QLOBcnt4WWrA5T Wd9njdw6al5oKnpTQJoSu3b2sRU+uC+cvqf+iqHodsOXQRjowQgydHelyNhGWA== Date: Mon, 23 Jun 2025 14:44:04 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250623124404.GI29660@pb2> References: <20250619030432.2977718-1-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgddujedthecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnheptefggedvffeiueffvefhiedtgfefjedukeefgeetgeevgeejgeekvdevjeelveeknecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/4] avformat/iamf_parse: Check extradata size 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 Content-Type: multipart/mixed; boundary="===============8276675703939014662==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8276675703939014662== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2zHIz+v3JuoR2Ovs" Content-Disposition: inline --2zHIz+v3JuoR2Ovs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 20, 2025 at 12:28:13AM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > Fixes: Assertion n>=3D0 && n<=3D32 failed at ./libavcodec/get_bits.h:406 > > Fixes: 398527871/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-= 6602025714647040 > >=20 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz= /tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/iamf_parse.c | 2 ++ > > 1 file changed, 2 insertions(+) > >=20 > > diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c > > index 71497876ac3..330e01733dd 100644 > > --- a/libavformat/iamf_parse.c > > +++ b/libavformat/iamf_parse.c > > @@ -305,6 +305,8 @@ static int update_extradata(AVCodecParameters *code= cpar) > > skip_bits(&gb, 4); > > put_bits(&pb, 4, codecpar->ch_layout.nb_channels); // set chan= nel config > > ret =3D put_bits_left(&pb); > > + if (ret < 0) > > + return AVERROR_INVALIDDATA; > > while (ret >=3D 32) { > > put_bits32(&pb, get_bits_long(&gb, 32)); > > ret -=3D 32; >=20 > There is only one way for put_bits_left() to return a negative value: If > there is more data in the internal buffer than can be written out. And > this scenario is already a violation of the PutBit API. Given that the > size of the internal buffer depends upon the arch, it could be that one > would have already hit an assert in case one is not using x64. In other > words, your check is too late. the patches puprose was mainly to show that 3f9420132441345b7ccd57001f230bb98f655696 was insufficient to fix 398527871 I do not expect my patch would be the correct solution even if the check is done earlier. IAMF is cursed thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. --2zHIz+v3JuoR2Ovs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaFlMDgAKCRBhHseHBAsP qxdpAJ9SIIR/TD/YG8Xw5iwOMeqieHMTxwCfaqN2FhNAvplN8MtidtAjYyO2E1o= =Fyr5 -----END PGP SIGNATURE----- --2zHIz+v3JuoR2Ovs-- --===============8276675703939014662== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --===============8276675703939014662==--