Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KMDOD: Correctly copy the DXGKRNL_INTERFACE structure #1020

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion video/KMDOD/bdd.cxx
Expand Up @@ -54,7 +54,15 @@ NTSTATUS BASIC_DISPLAY_DRIVER::StartDevice(_In_ DXGK_START_INFO* pDxgkStartIn
BDD_ASSERT(pNumberOfChildren != NULL);

RtlCopyMemory(&m_StartInfo, pDxgkStartInfo, sizeof(m_StartInfo));
RtlCopyMemory(&m_DxgkInterface, pDxgkInterface, sizeof(m_DxgkInterface));
// Real size of the DXGKRNL_INTERFACE structure is provided in its Size field, thus, copying
// sizeof(DXGKRNL_INTERFACE) might result in an access violation.
if (pDxgkInterface->Size > sizeof(m_DxgkInterface))
{
BDD_LOG_ASSERTION1("KMDOD: Provided interface cannot be used by KMOD (version %u)\n", pDxgkInterface->Version);
return STATUS_NOT_SUPPORTED;
}

RtlCopyMemory(&m_DxgkInterface, pDxgkInterface, pDxgkInterface->Size);
RtlZeroMemory(m_CurrentModes, sizeof(m_CurrentModes));
m_CurrentModes[0].DispInfo.TargetId = D3DDDI_ID_UNINITIALIZED;

Expand Down