From: Pavel Koshevoy <pkoshevoy-at-gmail.com@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] avformat/demux: Fix segfault due to avcodec_open2 failure (v2)
Date: Fri, 27 Jun 2025 19:34:30 -0600
Message-ID: <CAJgjuox7WFiZJECJPjZSH9MnL=s_r9ECPzx9zs+hpSExC7bJyg@mail.gmail.com> (raw)
In-Reply-To: <CAJgjuoyqGf1eGQGrb7rLOCuvcViZoXT=GZpaLPASU59e9bibsA@mail.gmail.com>
pushed in commit 59a6660625675c8343f3de858b93c8294f05bb52
On Tue, Jun 24, 2025 at 5:19 PM Pavel Koshevoy <pkoshevoy@gmail.com> wrote:
> If I don't hear any objections in the next 72 hours I will apply this at
> that time, or later if I forget.
>
> Pavel.
>
>
> On Mon, Jun 23, 2025 at 2:37 PM Pavel Koshevoy <pkoshevoy@gmail.com>
> wrote:
>
>> ping ... as this is a segfault fix for `ffplay/ffprobe -i 1_poc.mp4` I
>> think it deserves some review/approval priority.
>>
>> On Mon, Jun 9, 2025 at 9:45 PM Pavel Koshevoy <pkoshevoy@gmail.com>
>> wrote:
>>
>>> Fixes 'ffprobe 1_poc.mp4' segfault introduced with
>>> commit 0021484d05f9b0f032fa319399de6e24eea0c04f
>>>
>>> codec_close should not assume that the codec_id did not change.
>>> ---
>>> libavformat/demux.c | 8 +++++++-
>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavformat/demux.c b/libavformat/demux.c
>>> index ecd4f40da9..3749ab67a3 100644
>>> --- a/libavformat/demux.c
>>> +++ b/libavformat/demux.c
>>> @@ -1292,9 +1292,15 @@ static int codec_close(FFStream *sti)
>>> {
>>> AVCodecContext *avctx_new = NULL;
>>> AVCodecParameters *par_tmp = NULL;
>>> + const AVCodec *new_codec = NULL;
>>> int ret;
>>>
>>> - avctx_new = avcodec_alloc_context3(sti->avctx->codec);
>>> + new_codec =
>>> + (sti->avctx->codec_id != sti->pub.codecpar->codec_id) ?
>>> + avcodec_find_decoder(sti->pub.codecpar->codec_id) :
>>> + sti->avctx->codec;
>>> +
>>> + avctx_new = avcodec_alloc_context3(new_codec);
>>> if (!avctx_new) {
>>> ret = AVERROR(ENOMEM);
>>> goto fail;
>>> --
>>> 2.43.0
>>>
>>>
_______________________________________________
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".
prev parent reply other threads:[~2025-06-28 1:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 3:45 Pavel Koshevoy
2025-06-10 13:38 ` Michael Niedermayer
2025-06-10 14:42 ` Pavel Koshevoy
2025-06-10 15:29 ` Michael Niedermayer
2025-06-10 15:39 ` Pavel Koshevoy
2025-06-10 17:27 ` Pavel Koshevoy
2025-06-10 17:30 ` Nicolas George
2025-06-10 17:54 ` Pavel Koshevoy
2025-06-10 22:10 ` Michael Niedermayer
2025-06-10 23:36 ` Pavel Koshevoy
2025-06-11 10:14 ` Michael Niedermayer
2025-06-20 16:28 ` Pavel Koshevoy
2025-06-22 14:14 ` Michael Niedermayer
2025-06-11 15:51 ` Michael Niedermayer
2025-06-21 23:31 ` Pavel Koshevoy
2025-06-23 20:37 ` Pavel Koshevoy
2025-06-24 23:19 ` Pavel Koshevoy
2025-06-28 1:34 ` Pavel Koshevoy [this message]
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='CAJgjuox7WFiZJECJPjZSH9MnL=s_r9ECPzx9zs+hpSExC7bJyg@mail.gmail.com' \
--to=pkoshevoy-at-gmail.com@ffmpeg.org \
--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