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 C353F42539 for ; Wed, 5 Jan 2022 01:44:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5CF6A68A8A5; Wed, 5 Jan 2022 03:44:52 +0200 (EET) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C50FA687EBB for ; Wed, 5 Jan 2022 03:44:45 +0200 (EET) Received: by mail-io1-f47.google.com with SMTP id s6so37548490ioj.0 for ; Tue, 04 Jan 2022 17:44:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandflow-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=et7UOe+5joK+F79iQu0ZlFDkS+ncC3hPQN0UvO/Pjyg=; b=Q5qXbQrNujVeq6tYWeNwdWdT/NEfIy62yBAfCXQqjzegbkmhLhFIa0bWT4j26R2oCT +gQnAz3MDWaQpYepZs+GmI+A8XyKaT/4TQYzJHtKjhOWv3S5ShgABuZc8rQbHW7dzWPA vYoIW6PBLWXm/WxkigwTHEmdoVM7Dy17rybFgvdMM6YJAOy3vl9DgkxAwxvP1cxo2io9 mOe3TG3NtTZ6fLhs9X3cKsHuIUDIoP2ZoTbaX1K7Ag6rNrKpsNenpQWwOvnIDeyvjw65 9QUP2kv/dyvzRdikUfP6U/irqLYxgSLJkaaJ6D7G6neeefpI0oxYQvL5fduUYyCjiZ2a Zu1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=et7UOe+5joK+F79iQu0ZlFDkS+ncC3hPQN0UvO/Pjyg=; b=nfmeVbOFojDLT5Im1mttMnJr++RB7mfCNyrxEwl1a3wM1bg18+mEti3NetU/Q1Q+YD aO3dREaBrMqSmCfcussKzaQBR5qj2oLvK8FOLjgDd+1HoWsfiat+EAlHwxV8dfrw2zgh UGyH5GhESv6Fh07a0I02HLQa1Xg+WJ9kg4g/Ofm7gWfqrTufjxJ5JF9+1UCHdtclfEGM uIZEPqRgHcFcgzzDeKz2GgRTuXzrRhYDjkBIkLrCvS95FbkrM3bw86wTSB1ex6GWsw5V lRXa8Pg+wh1dVHpAa27xw9sKQZnGjSbzcKcvK4Dt/XA4DC37jNwTC6f4wgAvL1GA+vAH 2wJQ== X-Gm-Message-State: AOAM5302aaVRupSLFAZ8RbMfOhgT9ULZiWgOuJULRk2ZGU8dQNQm9auZ j/d9CquKo3cFhSYqEmUCwPJN5A46jZy6Pw== X-Google-Smtp-Source: ABdhPJwmpnXpPu0i2ODDEiFo4bgz9X8lHbQvoxhA4uu3Naaj174TUw+0NX9VRQYpu5udi5xdbIf1kg== X-Received: by 2002:a02:735e:: with SMTP id a30mr22396668jae.162.1641347083801; Tue, 04 Jan 2022 17:44:43 -0800 (PST) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com. [209.85.166.42]) by smtp.gmail.com with ESMTPSA id u14sm23716412ilv.66.2022.01.04.17.44.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jan 2022 17:44:43 -0800 (PST) Received: by mail-io1-f42.google.com with SMTP id l3so44221229iol.10 for ; Tue, 04 Jan 2022 17:44:43 -0800 (PST) X-Received: by 2002:a05:6638:72e:: with SMTP id j14mr21473718jad.246.1641347083044; Tue, 04 Jan 2022 17:44:43 -0800 (PST) MIME-Version: 1.0 References: <20220103155919.12015-1-pal@sandflow.com> In-Reply-To: From: Pierre-Anthony Lemieux Date: Tue, 4 Jan 2022 17:44:31 -0800 X-Gmail-Original-Message-ID: Message-ID: To: FFmpeg development discussions and patches 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-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 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. > > if (!(c->base_url = av_strdup(s->url))) > return AVERROR(ENOMEM); > > c->base_url = av_dirname(c->base_url); > _______________________________________________ > 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".