mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-08-28 17:17:02 +00:00
fix: check the frame QueryInterface result in dxgi capture
Both AcquireNextFrame paths cast the IDXGIResource to ID3D11Texture2D without looking at the HRESULT. ohgodwhat() then dereferences the null pointer in GetDesc(), and get_texture() hands a null texture to the vram encoder. Return the error instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sw75MSAz7PTqrSALdStXe
This commit is contained in:
co-authored by
Claude Opus 5
parent
7c830e76c6
commit
9343affe0b
@@ -357,10 +357,10 @@ impl Capturer {
|
||||
// copy from GPU memory to system memory
|
||||
unsafe fn ohgodwhat(&mut self, frame: *mut IDXGIResource) -> io::Result<()> {
|
||||
let mut texture: *mut ID3D11Texture2D = ptr::null_mut();
|
||||
(*frame).QueryInterface(
|
||||
wrap_hresult((*frame).QueryInterface(
|
||||
&IID_ID3D11Texture2D,
|
||||
&mut texture as *mut *mut _ as *mut *mut _,
|
||||
);
|
||||
))?;
|
||||
let texture = ComPtr(texture);
|
||||
|
||||
#[allow(invalid_value)]
|
||||
@@ -500,10 +500,10 @@ impl Capturer {
|
||||
}
|
||||
|
||||
let mut texture: *mut ID3D11Texture2D = ptr::null_mut();
|
||||
(*frame.0).QueryInterface(
|
||||
wrap_hresult((*frame.0).QueryInterface(
|
||||
&IID_ID3D11Texture2D,
|
||||
&mut texture as *mut *mut _ as *mut *mut _,
|
||||
);
|
||||
))?;
|
||||
let texture = ComPtr(texture);
|
||||
self.texture = texture;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user