From: Marth64 <marth64@proxyid.net>
To: Marth64 <marth64@proxyid.net>
Cc: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 3/4] avformat/dvdvideodec: Only free allocated buffers
Date: Sat, 2 Mar 2024 20:32:48 -0600
Message-ID: <CA+28BfAyvLfpCtcsPOmCLbycbXaeRCrtGPoT1OmdSM+ihZS6-g@mail.gmail.com> (raw)
In-Reply-To: <CA+28BfB64A_ra6ZoYhY6nrkbS87YdB+nAgZNp=gAzOdm0EGc5A@mail.gmail.com>
Nevermind, disregard. They do not, and I misread. Thanks for catching this.
On Sat, Mar 2, 2024 at 8:31 PM Marth64 <marth64@proxyid.net> wrote:
> FYI: hls, dashdec do the same av_freep(). Doesn't make this right, but
> saying that was where I used as an example (so they should probably fixed
> too?)
>
> On Sat, Mar 2, 2024 at 10:17 AM Andreas Rheinhardt <
> andreas.rheinhardt@outlook.com> wrote:
>
>> James Almer:
>> > On 3/2/2024 12:47 PM, Andreas Rheinhardt wrote:
>> >> Andreas Rheinhardt:
>> >>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> >>> ---
>> >>> How has this slipped through?
>> >>
>> >> Answer: AVIOContext starts with an AVClass* that is unset when using
>> >> ffio_init_context(). Therefore the av_freep() leads to freeing of a
>> NULL
>> >> pointer which does not segfault.
>> >
>> > Would setting s->av_class to &ff_avio_options in ffio_init_context()
>> > prevent this from happening again?
>> >
>>
>> ff_avio_options is not an AVClass, so this is wrong; setting it to
>> ff_avio_class would also be wrong, because said class is only to be used
>> with the URLProtocol-based AVIOContexts (the child_next and
>> child_class_iterate callbacks are designed for this; the former returns
>> the AVIOContext's opaque, believing it to point to an URLContext, yet in
>> general it need not point to an AVClass-enabled struct at all).
>>
>> In fact, ff_avio_options etc. should be moved to avio.c. I'll look into
>> this.
>>
>> >>
>> >>> Btw: This patchset is based upon code inspection, not on reading
>> >>> actual files.
>> >>>
>> >>> libavformat/dvdvideodec.c | 1 -
>> >>> 1 file changed, 1 deletion(-)
>> >>>
>> >>> diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
>> >>> index ef2d4e6df4..f2f23affb2 100644
>> >>> --- a/libavformat/dvdvideodec.c
>> >>> +++ b/libavformat/dvdvideodec.c
>> >>> @@ -1202,7 +1202,6 @@ static void
>> >>> dvdvideo_subdemux_close(AVFormatContext *s)
>> >>> DVDVideoDemuxContext *c = s->priv_data;
>> >>> av_freep(&c->mpeg_pb.pub.buffer);
>> >>> - av_freep(&c->mpeg_pb);
>> >>> avformat_close_input(&c->mpeg_ctx);
>> >>> }
>> >>>
>> >>
>>
>> _______________________________________________
>> 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".
next prev parent reply other threads:[~2024-03-03 2:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-02 15:42 [FFmpeg-devel] [PATCH 1/4] avformat/dvdvideodec: Explicitly return 0 on success Andreas Rheinhardt
2024-03-02 15:43 ` [FFmpeg-devel] [PATCH 2/4] avformat/dvdvideodec: Don't store AVInputFormat* Andreas Rheinhardt
2024-03-02 15:43 ` [FFmpeg-devel] [PATCH 3/4] avformat/dvdvideodec: Only free allocated buffers Andreas Rheinhardt
2024-03-02 15:47 ` Andreas Rheinhardt
2024-03-02 15:51 ` James Almer
2024-03-02 16:19 ` Andreas Rheinhardt
2024-03-03 2:31 ` Marth64
2024-03-03 2:32 ` Marth64 [this message]
2024-03-02 15:43 ` [FFmpeg-devel] [PATCH 4/4] avformat/dvdvideodec: Reorder allocations to simplify freeing Andreas Rheinhardt
2024-03-03 2:34 ` Marth64
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+28BfAyvLfpCtcsPOmCLbycbXaeRCrtGPoT1OmdSM+ihZS6-g@mail.gmail.com \
--to=marth64@proxyid.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git