summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHumberto Ribeiro <mont3z.claro5@gmail.com>2018-01-03 15:22:15 -0800
committerwm4 <nfxjfg@googlemail.com>2018-01-04 15:41:40 +0100
commit59b126f92225316e0cd77bb952d630553801dc85 (patch)
tree68b5d8170973230541f36fb0cffba2da5775bc4f
parent1b283c4a0dde1060ca1745f59a15cb8b77dfdaa5 (diff)
downloadffmpeg-streaming-59b126f92225316e0cd77bb952d630553801dc85.zip
ffmpeg-streaming-59b126f92225316e0cd77bb952d630553801dc85.tar.gz
libavutil/hwcontext_dxva2: Add check for possible errors from GetAdapterDisplayModeEx
This prevents a possible crash in CreateDeviceEx when using faulty response from GetAdapterDisplayModeEx and allows ffmpeg to fallback to classic d3d9. Signed-off-by: wm4 <nfxjfg@googlemail.com>
-rw-r--r--libavutil/hwcontext_dxva2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c
index 2ddd4be..44ebdbc 100644
--- a/libavutil/hwcontext_dxva2.c
+++ b/libavutil/hwcontext_dxva2.c
@@ -485,7 +485,11 @@ static int dxva2_device_create9ex(AVHWDeviceContext *ctx, UINT adapter)
if (FAILED(hr))
return AVERROR_UNKNOWN;
- IDirect3D9Ex_GetAdapterDisplayModeEx(d3d9ex, adapter, &modeex, NULL);
+ hr = IDirect3D9Ex_GetAdapterDisplayModeEx(d3d9ex, adapter, &modeex, NULL);
+ if (FAILED(hr)) {
+ IDirect3D9Ex_Release(d3d9ex);
+ return AVERROR_UNKNOWN;
+ }
d3dpp.BackBufferFormat = modeex.Format;
OpenPOWER on IntegriCloud