Skip to content

Commit

Permalink
win-capture: Avoid NULL deref when capture not initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
confusionattack authored and Lain-B committed Nov 9, 2024
1 parent 7979421 commit 318ef97
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion plugins/win-capture/graphics-hook/d3d10-capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ static inline void d3d10_copy_texture(ID3D10Resource *dst, ID3D10Resource *src)

static inline void d3d10_shtex_capture(ID3D10Resource *backbuffer)
{
d3d10_copy_texture(data.texture, backbuffer);
if (data.texture) {
d3d10_copy_texture(data.texture, backbuffer);
}
}

static void d3d10_shmem_capture_copy(int i)
Expand Down
4 changes: 3 additions & 1 deletion plugins/win-capture/graphics-hook/d3d11-capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ static inline void d3d11_copy_texture(ID3D11Resource *dst, ID3D11Resource *src)

static inline void d3d11_shtex_capture(ID3D11Resource *backbuffer)
{
d3d11_copy_texture(data.texture, backbuffer);
if (data.texture) {
d3d11_copy_texture(data.texture, backbuffer);
}
}

static void d3d11_shmem_capture_copy(int i)
Expand Down
4 changes: 4 additions & 0 deletions plugins/win-capture/graphics-hook/d3d12-capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ static inline void d3d12_copy_texture(ID3D11Resource *dst, ID3D11Resource *src)

static inline void d3d12_shtex_capture(IDXGISwapChain *swap)
{
if (!data.device11on12) {
return;
}

bool dxgi_1_4 = data.dxgi_1_4;
UINT cur_idx;

Expand Down
2 changes: 1 addition & 1 deletion shared/obs-hook-config/graphics-hook-ver.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#define HOOK_VER_MAJOR 1
#define HOOK_VER_MINOR 8
#define HOOK_VER_PATCH 5
#define HOOK_VER_PATCH 6

#ifndef STRINGIFY
#define STRINGIFY(s) #s
Expand Down

0 comments on commit 318ef97

Please sign in to comment.