Просмотр исходного кода

graphics-hook: Fix null pointer dereference

Multiple APIs may be set up to capture without being initialized in
graphics-hook when multiple threads are sending present calls. This just
prevents those invalid captures from completing.
Charlese2 1 год назад
Родитель
Сommit
0b87f533b2

+ 1 - 1
plugins/win-capture/graphics-hook/d3d10-capture.cpp

@@ -333,7 +333,7 @@ void d3d10_capture(void *swap_ptr, void *backbuffer_ptr)
 	if (capture_should_init()) {
 		d3d10_init(swap);
 	}
-	if (capture_ready()) {
+	if (data.handle != nullptr && capture_ready()) {
 		ID3D10Resource *backbuffer;
 
 		hr = dxgi_backbuffer->QueryInterface(__uuidof(ID3D10Resource), (void **)&backbuffer);

+ 1 - 1
plugins/win-capture/graphics-hook/d3d11-capture.cpp

@@ -301,7 +301,7 @@ void d3d11_capture(void *swap_ptr, void *backbuffer_ptr)
 	if (capture_should_init()) {
 		d3d11_init(swap);
 	}
-	if (capture_ready()) {
+	if (data.handle != nullptr && capture_ready()) {
 		ID3D11Resource *backbuffer;
 
 		hr = dxgi_backbuffer->QueryInterface(__uuidof(ID3D11Resource), (void **)&backbuffer);

+ 1 - 1
plugins/win-capture/graphics-hook/d3d12-capture.cpp

@@ -315,7 +315,7 @@ void d3d12_capture(void *swap_ptr, void *)
 	if (capture_should_init()) {
 		d3d12_init(swap);
 	}
-	if (capture_ready()) {
+	if (data.handle != nullptr && capture_ready()) {
 		d3d12_shtex_capture(swap);
 	}
 }

+ 1 - 1
plugins/win-capture/graphics-hook/d3d9-capture.cpp

@@ -543,7 +543,7 @@ static void d3d9_capture(IDirect3DDevice9 *device, IDirect3DSurface9 *backbuffer
 	if (capture_should_init()) {
 		d3d9_init(device);
 	}
-	if (capture_ready()) {
+	if (data.handle != nullptr && capture_ready()) {
 		if (data.device != device) {
 			d3d9_free();
 			return;

+ 1 - 1
shared/obs-hook-config/graphics-hook-ver.h

@@ -13,7 +13,7 @@
 
 #define HOOK_VER_MAJOR 1
 #define HOOK_VER_MINOR 8
-#define HOOK_VER_PATCH 4
+#define HOOK_VER_PATCH 5
 
 #ifndef STRINGIFY
 #define STRINGIFY(s) #s