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 502F04254D for ; Wed, 5 Jan 2022 02:30:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7EA2B68A8E7; Wed, 5 Jan 2022 04:30:33 +0200 (EET) Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AC2CF687992 for ; Wed, 5 Jan 2022 04:30:27 +0200 (EET) Message-ID: <09eaf8ff-65f6-0df5-39a9-41ba5ba5a95a@zanevaniperen.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=key1; t=1641349825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VROF0fKkYxdBRzchSN24eu93tvGwzHPskWrTXdrJDr4=; b=OR08Uk15W8wJPeh1L3J+YrPsUaEWwUk+roHnFAHBnRzKbDlJSolRPZuwS4NczCkuVo9J7r 7SX8+oWLxUdTviNkUW9Z2KarqljxCSvhtC2uLi/oC1syQu5B4WiTIsU4XSet8qE+Ab2Bmn qjtLtRuD2518P3n7E4H7vPmqI4aIlVFhn9tPb66tkbNrobMl99bptCT9GBMHOkmcDoKSDp NhncYIXLSngzSkBJEbmhD3iynVoZyPcLw+g9dCUMDR+hxIICVEq8SRPTE1XCpgeKI9LbKY LgueRBTdM3VQKvSGG3C8rFRuT479jIKhjCZugxL8smPE7NCHZEG7TOxettpNVQ== Date: Wed, 5 Jan 2022 12:30:20 +1000 MIME-Version: 1.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220103155919.12015-1-pal@sandflow.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zane van Iperen In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: zanevaniperen.com Subject: Re: [FFmpeg-devel] [PATCH v1] avformat/imf: fix bad free() when directory name of the input url is empty 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 5/1/22 11:44, Pierre-Anthony Lemieux wrote: > On Tue, Jan 4, 2022 at 5:39 PM Zane van Iperen wrote: >> >> >> >> On 4/1/22 01:59, pal@sandflow.com wrote: >>> From: Pierre-Anthony Lemieux >>> >>> Signed-off-by: Pierre-Anthony Lemieux >>> --- >>> >>> Notes: >>> Found through manual fuzzing. >>> >>> libavformat/imfdec.c | 6 +++++- >>> 1 file changed, 5 insertions(+), 1 deletion(-) >>> >>> diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c >>> index f17064cfcd..4e42db8d30 100644 >>> --- a/libavformat/imfdec.c >>> +++ b/libavformat/imfdec.c >>> @@ -622,11 +622,15 @@ static int imf_read_header(AVFormatContext *s) >>> int ret = 0; >>> >>> c->interrupt_callback = &s->interrupt_callback; >>> + >>> tmp_str = av_strdup(s->url); >>> if (!tmp_str) >>> return AVERROR(ENOMEM); >>> + c->base_url = av_strdup(av_dirname(tmp_str)); >> >> Is the second av_strdup() here required? You've already done it above >> and av_dirname() just sticks a '\0' at the last separator, > > This is what I thought. > >> so it should >> be safe to remove it: > > As I understand it, av_dirname() actually returns a pointer to its own > "." string when the input is either empty or does not contain, in > which case we must make a copy. > You're right. This is ugly, but I don't see a nicer way to do it. This lgtm then. _______________________________________________ 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".