From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5B3244A50A for ; Wed, 1 May 2024 00:38:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C12BE68D648; Wed, 1 May 2024 03:38:32 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 042F468D442 for ; Wed, 1 May 2024 03:38:26 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6C67D20005 for ; Wed, 1 May 2024 00:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1714523906; 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=wRO4x2vYrHJkMnH4Fk9hN6RvtDHyH721epgLiJxg5RI=; b=eRO9K7pUAgXHTmB/wphHTKuaF2tEZQn2psXdRasKkGUjDneCiRBpXwdjyo5QAExxdb/Au1 p1oTouUDj2Iz/m03bJ8PDxpIyKOqUAmJS1Os2JjGaDqZfLCHDmcx8LZ/GnX93FLdxMijMR sjHjyBZLlXgegznW1+m2wTiNH0y/r0taVIUWgvWAfhQo65oxwmHcJpNj40sfdZmNufnjZF NqZKf2IZPTPtL/rK6yJV87pk7RvS/hGQPod9vMoX3QFp9x3Gpz8QihkV0o+0bIB6n376uj xfhYalPDCkYXlMTKUxpiw8jFhRnEdLhJKn5BOsOZIU1P/1emhfBPaRJFCCNvQQ== Date: Wed, 1 May 2024 02:38:25 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240501003825.GA6420@pb2> References: <20240430004854.199741-1-michael@niedermayer.cc> <20240430004854.199741-3-michael@niedermayer.cc> <1a2550a7-4881-4d0d-a553-1b4693907f77@gmail.com> MIME-Version: 1.0 In-Reply-To: <1a2550a7-4881-4d0d-a553-1b4693907f77@gmail.com> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 3/3] avutil/opt: Preserve nb_channels in opt_free 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="===============3911080278349522304==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============3911080278349522304== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GCDnF6IjHoCpwYa4" Content-Disposition: inline --GCDnF6IjHoCpwYa4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 30, 2024 at 06:27:23PM -0300, James Almer wrote: > On 4/29/2024 9:48 PM, Michael Niedermayer wrote: > > Fixes: division by 0 > > Fixes: decoder modifying demuxer channels on failure > > Fixes: -sseof -5 -i zgclab/ffmpeg_crash/poc3 > >=20 > > Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory > > Signed-off-by: Michael Niedermayer > > --- > > libavutil/opt.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > >=20 > > diff --git a/libavutil/opt.c b/libavutil/opt.c > > index ecbf7efe5fb..24c08e4bc06 100644 > > --- a/libavutil/opt.c > > +++ b/libavutil/opt.c > > @@ -132,9 +132,11 @@ static void opt_free_elem(const AVOption *o, void = *ptr) > > av_dict_free((AVDictionary **)ptr); > > break; > > - case AV_OPT_TYPE_CHLAYOUT: > > + case AV_OPT_TYPE_CHLAYOUT: { > > + int nb_channels =3D ((AVChannelLayout *)ptr)->nb_channels; > > av_channel_layout_uninit((AVChannelLayout *)ptr); > > - break; > > + ((AVChannelLayout *)ptr)->nb_channels =3D nb_channels; > > + break;} > > default: > > break; >=20 > A little bit of context would be helpful here. What's using nb_channels > after av_opt_free was called and where? demuxer sets nb_channels find stream info copies codec params to context find stream info tries opening decoder decoder, refuses, and opt_free_elem() is called on cleanup context now has 0 channels context gets copied into params of demuxer demuxer goes like i have set the channels to a non zero value let me devide= by them and oops there is more than one position in this chain of events this can be fixed thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes --GCDnF6IjHoCpwYa4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZjGPAQAKCRBhHseHBAsP qxUoAJ9d3Ai4qOF1wTCtVWiizbvMCO8eYgCdFtn+08TLuLFY7/C5nJgWsue141w= =Hw0M -----END PGP SIGNATURE----- --GCDnF6IjHoCpwYa4-- --===============3911080278349522304== 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". --===============3911080278349522304==--