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 B47F547CFD for ; Sun, 19 Nov 2023 10:11:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 45A3168CD5A; Sun, 19 Nov 2023 12:11:10 +0200 (EET) Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3C1EB68CC40 for ; Sun, 19 Nov 2023 12:11:02 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:To:From:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AjafSkzPp5RtE+46GR+A6v83bFD3NictduKgR8jC6cw=; b=p0y7qtc9gYdPhrKe/xM21cnssv fO+vNOOGlz5Tt951IEkirbOA1Iabi1GPRhccaQMlsccBr/EXafnk4DLLRfg10P4ReK4142ls73Sp9 ZbSH63m9YL5WjFOztSe5ZbGPTUZ8Iqke0QSXuwUTkPLh4Gtz9pdhBC7pcaz5sraJ9bIKqysJZhcDJ xDf9EG2HrfOHFSnvQ1I014Yu3q9SmZg2jckJfvWVGYd5BOQsq39UDhMyrvuN07XLnb2H3EjpACeXV OrHdGq0CqwuR/beC+tLH3+rbAJVQ1Ie4WwVJtzcexDh7Gt7rFqrSKiJqFL14AYUGV1vtl51Cvu/OM XbRGPcVg==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1r4elY-002x9w-Fs for ffmpeg-devel@ffmpeg.org; Sun, 19 Nov 2023 10:11:01 +0000 Received: by jupiter.ramacher.at (Postfix, from userid 1000) id CA0FC103217C3; Sun, 19 Nov 2023 11:10:59 +0100 (CET) Date: Sun, 19 Nov 2023 11:10:59 +0100 From: Sebastian Ramacher To: FFmpeg development discussions and patches Message-ID: References: <1699986151-24741-1-git-send-email-dmitry.v.rogozhkin@intel.com> <1700240583-793-1-git-send-email-dmitry.v.rogozhkin@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1700240583-793-1-git-send-email-dmitry.v.rogozhkin@intel.com> X-Debian-User: sramacher Subject: Re: [FFmpeg-devel] [PATCH v3] avcodec/decode: guard against NULL hw_frames_ctx 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 2023-11-17 09:03:03 -0800, Dmitry Rogozhkin wrote: > Guard against segfault running VLC decoding under msys2 [1]: > > Thread 33 received signal SIGSEGV, Segmentation fault. > [Switching to Thread 37728.0xadd0] > ff_hwaccel_frame_priv_alloc (avctx=0x6447b00, hwaccel_picture_private=0x65dfd00) > at libavcodec/decode.c:1848 > 1848 frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; > (gdb) bt > at libavcodec/decode.c:1848 > at libavcodec/h264_slice.c:208 > first_slice=1) at libavcodec/h264_slice.c:1599 > at libavcodec/h264_slice.c:2130 > at libavcodec/h264dec.c:652 > got_frame=0x646e4b0, avpkt=0x64522c0) at libavcodec/h264dec.c:1048 > > (gdb) p avctx > $1 = (AVCodecContext *) 0x6447b00 > (gdb) p avctx->hw_frames_ctx > $2 = (AVBufferRef *) 0x0 > > v2: check for free_frame_priv (Hendrik) > v3: return EINVAL (Christoph Reiter) > > See[1]: https://github.com/msys2/MINGW-packages/pull/19050 > Fixes: be07145109 ("avcodec: add AVHWAccel.free_frame_priv callback") > CC: Lynne > CC: Christoph Reiter > Signed-off-by: Dmitry Rogozhkin We have also seen the same issue on Debian unstable with VDPAU playback in vlc. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1055952. I can confirm that this patch fixes the issue. Please apply the patch and backport it to 6.1. Cheers > --- > libavcodec/decode.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > index ad39021..50c3995 100644 > --- a/libavcodec/decode.c > +++ b/libavcodec/decode.c > @@ -1838,17 +1838,25 @@ int ff_copy_palette(void *dst, const AVPacket *src, void *logctx) > int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_private) > { > const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); > - AVHWFramesContext *frames_ctx; > > if (!hwaccel || !hwaccel->frame_priv_data_size) > return 0; > > av_assert0(!*hwaccel_picture_private); > > - frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; > - *hwaccel_picture_private = ff_refstruct_alloc_ext(hwaccel->frame_priv_data_size, 0, > - frames_ctx->device_ctx, > - hwaccel->free_frame_priv); > + if (hwaccel->free_frame_priv) { > + AVHWFramesContext *frames_ctx; > + > + if (!avctx->hw_frames_ctx) > + return AVERROR(EINVAL); > + > + *hwaccel_picture_private = ff_refstruct_alloc_ext(hwaccel->frame_priv_data_size, 0, > + frames_ctx->device_ctx, > + hwaccel->free_frame_priv); > + } else { > + *hwaccel_picture_private = ff_refstruct_allocz(hwaccel->frame_priv_data_size); > + } > + > if (!*hwaccel_picture_private) > return AVERROR(ENOMEM); > > -- > 1.8.3.1 > > _______________________________________________ > 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".