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 38DEC47614 for ; Thu, 14 Dec 2023 14:40:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 818F368D28E; Thu, 14 Dec 2023 16:40:43 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0B38968B4D7 for ; Thu, 14 Dec 2023 16:40:37 +0200 (EET) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id BC3854B5C8; Thu, 14 Dec 2023 15:40:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1702564836; bh=kVy/974ClOeeW6QHiFeYJZi0RML7x3nBPhxD8duAlw0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UBuMSPjDzd3oVuPCKUVfWyQynPee8kMZ/Jtsc8yKBVooD/YULYZ6Dx7cEgdQglhL2 hI5J9Qo7xDtppMX/GCpO2iTp1/jlDtIskXXnsoQP15+OfBinuakJTgTsN24BT9K4yG 5LdynXwCIREMjxVY2rh7ZDGt1LVGXdvK8ca2EUog= Date: Thu, 14 Dec 2023 15:40:36 +0100 Message-ID: <20231214154036.GB39465@haasn.xyz> From: Niklas Haas To: ffmpeg-devel@ffmpeg.org In-Reply-To: <20231214143911.39198-1-ffmpeg@haasn.xyz> References: <20231214030948.GH6420@pb2> <20231214143911.39198-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Content-Disposition: inline Subject: Re: [FFmpeg-devel] [PATCH] avfilter/formats: set audio fmt lists for vaf filters 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 Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Thu, 14 Dec 2023 15:39:11 +0100 Niklas Haas wrote: > From: Niklas Haas > > Currently, the logic inside the FF_FILTER_FORMATS_QUERY_FUNC branch > prevents this code from running in the event that we have a filter with > a single video input and a single audio output, as the resulting audio > output link will not have its channel counts / samplerates correctly > initialized to their default values, possibly triggering a segfault > downstream. > > An example of such a filter is vaf_spectrumsynth. Although this > particular filter already sets up the channel counts and samplerates as > part of the query function and therefore avoids triggering this bug, the > bug still exists in principle. (And importantly, sets a wrong precedent) > --- > libavfilter/formats.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/libavfilter/formats.c b/libavfilter/formats.c > index d1c97daf64..114886aeb2 100644 > --- a/libavfilter/formats.c > +++ b/libavfilter/formats.c > @@ -808,16 +808,17 @@ int ff_default_query_formats(AVFilterContext *ctx) > /* Intended fallthrough */ > case FF_FILTER_FORMATS_PASSTHROUGH: > case FF_FILTER_FORMATS_QUERY_FUNC: > - type = ctx->nb_inputs ? ctx->inputs [0]->type : > - ctx->nb_outputs ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; > - formats = ff_all_formats(type); > + type = AVMEDIA_TYPE_UNKNOWN; > + formats = ff_all_formats(ctx->nb_inputs ? ctx->inputs [0]->type : > + ctx->nb_outputs ? ctx->outputs[0]->type : > + AVMEDIA_TYPE_VIDEO); > break; > } > > ret = ff_set_common_formats(ctx, formats); > if (ret < 0) > return ret; > - if (type == AVMEDIA_TYPE_AUDIO) { > + if (type != AVMEDIA_TYPE_VIDEO) { > ret = ff_set_common_all_channel_counts(ctx); > if (ret < 0) > return ret; > -- > 2.43.0 > This patch fixes the underlying issue (alongside the corresponding adjustment to the conditional from `type == AVMEDIA_TYPE_VIDEO` to `type != AVMEDIA_TYPE_AUDIO` in patch 03/15). _______________________________________________ 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".