[vlc-commits] d3d11_fmt: don't crash on missing external ID3D11DeviceContext

Steve Lhomme git at videolan.org
Fri Apr 2 13:55:51 UTC 2021


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 24 08:43:25 2021 +0100| [f3b16b6f828d0720451b02af7078a383d9132e8e] | committer: Steve Lhomme

d3d11_fmt: don't crash on missing external ID3D11DeviceContext

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f3b16b6f828d0720451b02af7078a383d9132e8e
---

 modules/video_chroma/d3d11_fmt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index ec89837b78..988cf98fd7 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -322,6 +322,12 @@ void D3D11_ReleaseDevice(d3d11_decoder_device_t *dev_sys)
 static HRESULT D3D11_CreateDeviceExternal(vlc_object_t *obj, ID3D11DeviceContext *d3d11ctx,
                                    bool hw_decoding, d3d11_device_t *out)
 {
+    if (unlikely(d3d11ctx == NULL))
+    {
+        msg_Err(obj, "missing external ID3D11DeviceContext");
+        return S_FALSE;
+    }
+
     HRESULT hr;
     ID3D11DeviceContext_GetDevice( d3d11ctx, &out->d3ddevice );
 



More information about the vlc-commits mailing list