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 951EC4A514 for ; Wed, 1 May 2024 00:41:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 82C1668D64E; Wed, 1 May 2024 03:41:56 +0300 (EEST) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3F9DF68D422 for ; Wed, 1 May 2024 03:41:50 +0300 (EEST) Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6f30f69a958so5493050b3a.1 for ; Tue, 30 Apr 2024 17:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714524107; x=1715128907; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=CQWzaf3bXnhKKqktrClBnXhmSras3G2nMo+QU6sPKTM=; b=ZySOQsIuLEcPCgMZ4ho0v2zyKrXjqRaLb+IfQBEYXazDZOCyXUPG908dQbbJHnYAiT GhAMwSRvvchxLTekn4pGOcSixJHQDNykleY7Zo9/K1RhzL+sbKSVlxyG/d+cdiksjP1J E5tyXeX0fKMP3P6Qx/bx9vO9crg95Oau7OTUdCOo5PYmyLwyQmMZAAyLdrEEJjar54N9 bouUe1Oc/USf55uSQeUFbStubyeU0VU8jQnc63tSLofdzc8PFdjMCfaOVL9r3Zc9uE73 DV6mZ0foOPV0E6VFLx4sc6o4FNJiwThxzycayjgSF2tzZPYZJ5T85Tk43RilFMTZmm0a CKJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714524107; x=1715128907; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CQWzaf3bXnhKKqktrClBnXhmSras3G2nMo+QU6sPKTM=; b=eHkVt2H5unPOrWXUNU8rbJP/D++0OjuMPg3DaiIVdGphiuFcjH6Ws15+N+fqaAuh6F F48TuPp/s392SvF5eEl3DbRB7a7StgbBf24L20hXxuZ8A+Og5ayjLjsds6LUp8spXgGx Zsf3Oo3ZZY2bsCnB89ZZZpZ1ggplycdZ1orFNlN0cx9AGbtfaepmftdFsvH/if53WM47 kRj6e957SSd8oleESOtUxeCeh6/fKlGd6E0IInaoOrOmL78R73Xa6ZJGFrhm2klW9j68 TrsssUzSYMwPdDRcUtNmx+3iBzsOD1gCpBHTjqdE4u6EnBfbmgfTxft+tY4Kcwww+lam QBDg== X-Gm-Message-State: AOJu0YwyZB3KZmulV6+ZkR7ts6q6U685aqRisR+m5gdATaeAHsth6ZKT IQMJ2Cp/6qG9rHlRyW+wCp75RGiJIR3HQFk/hOtjuAfvTW3WOdh9RO7pqA== X-Google-Smtp-Source: AGHT+IHGGlUpJUCe+QfKK/KLWtJv+ib6eJvksgDHynSw5W+MuMzFfH+RRGiJrRcMs3/zUchHZDccoQ== X-Received: by 2002:a05:6a20:1041:b0:1af:66aa:f96a with SMTP id gt1-20020a056a20104100b001af66aaf96amr1202168pzc.1.1714524107148; Tue, 30 Apr 2024 17:41:47 -0700 (PDT) Received: from [192.168.0.10] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id cz16-20020a17090ad45000b002b206acbbb3sm220287pjb.30.2024.04.30.17.41.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Apr 2024 17:41:46 -0700 (PDT) Message-ID: <78dc5659-da2b-4483-a304-f29baaea1ba5@gmail.com> Date: Tue, 30 Apr 2024 21:41:43 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20240430004854.199741-1-michael@niedermayer.cc> <20240430004854.199741-3-michael@niedermayer.cc> <1a2550a7-4881-4d0d-a553-1b4693907f77@gmail.com> <20240501003825.GA6420@pb2> Content-Language: en-US From: James Almer In-Reply-To: <20240501003825.GA6420@pb2> 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 4/30/2024 9:38 PM, Michael Niedermayer wrote: > 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 >>> >>> 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(-) >>> >>> 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 = ((AVChannelLayout *)ptr)->nb_channels; >>> av_channel_layout_uninit((AVChannelLayout *)ptr); >>> - break; >>> + ((AVChannelLayout *)ptr)->nb_channels = nb_channels; >>> + break;} >>> default: >>> break; >> >> 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 Should this happen if the internal decoder failed to generate a frame? Can it be avoided? > 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 > > [...] > > > _______________________________________________ > 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". _______________________________________________ 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".