[vlc-commits] [Git][videolan/vlc][3.0.x] contrib: ffmpeg: fix a rare crash on some odd files with DVXA

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Aug 24 06:05:35 UTC 2022



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
ad8bbb0d by Steve Lhomme at 2022-08-24T05:20:48+00:00
contrib: ffmpeg: fix a rare crash on some odd files with DVXA

There is a cleaner fix proposed but it may have wider impacts and needs to be
checked on all platforms:
https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg137976.html

This one should be safe for 3.0.18

- - - - -


2 changed files:

- + contrib/src/ffmpeg/0001-avcodec-pthread_frame-do-not-give-the-hardware-conte.patch
- contrib/src/ffmpeg/rules.mak


Changes:

=====================================
contrib/src/ffmpeg/0001-avcodec-pthread_frame-do-not-give-the-hardware-conte.patch
=====================================
@@ -0,0 +1,43 @@
+From 2a2937b72e2ef17170a7cd617be3cfa578115b7a Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Tue, 17 Dec 2019 11:21:17 +0100
+Subject: [PATCH] avcodec/pthread_frame: do not give the hardware context
+ internals to the user
+
+The internal data should not leak to the user. It can potentially be destroyed
+twice since the hwaccel uninit was also copied back to the user.
+
+This behaviour may only be found in VLC which uses frame threading with hardware
+decoding.
+---
+ libavcodec/pthread_frame.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
+index 9176027f15..26439c1058 100644
+--- a/libavcodec/pthread_frame.c
++++ b/libavcodec/pthread_frame.c
+@@ -293,14 +293,17 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
+         dst->color_range = src->color_range;
+         dst->chroma_sample_location = src->chroma_sample_location;
+ 
+-        dst->hwaccel = src->hwaccel;
+-        dst->hwaccel_context = src->hwaccel_context;
++        if (!for_user) {
++            dst->hwaccel = src->hwaccel;
++            dst->hwaccel_context = src->hwaccel_context;
++        }
+ 
+         dst->channels       = src->channels;
+         dst->sample_rate    = src->sample_rate;
+         dst->sample_fmt     = src->sample_fmt;
+         dst->channel_layout = src->channel_layout;
+-        dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data;
++        if (!for_user)
++            dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data;
+ 
+         if (!!dst->hw_frames_ctx != !!src->hw_frames_ctx ||
+             (dst->hw_frames_ctx && dst->hw_frames_ctx->data != src->hw_frames_ctx->data)) {
+-- 
+2.27.0.windows.1
+


=====================================
contrib/src/ffmpeg/rules.mak
=====================================
@@ -246,6 +246,9 @@ ifdef USE_FFMPEG
 	$(APPLY) $(SRC)/ffmpeg/0001-bring-back-XP-support.patch
 	$(APPLY) $(SRC)/ffmpeg/0001-avcodec-vp9-Do-not-destroy-uninitialized-mutexes-con.patch
 	$(APPLY) $(SRC)/ffmpeg/0001-dxva2_hevc-don-t-use-frames-as-reference-if-they-are.patch
+ifdef HAVE_WIN32
+	$(APPLY) $(SRC)/ffmpeg/0001-avcodec-pthread_frame-do-not-give-the-hardware-conte.patch
+endif
 endif
 ifdef USE_LIBAV
 	$(APPLY) $(SRC)/ffmpeg/libav_gsm.patch



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ad8bbb0d4ba523b405d8134caf357ae78009b94a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ad8bbb0d4ba523b405d8134caf357ae78009b94a
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list