Skip to content

Commit

Permalink
EDGEML-6881 Random test failure when looking for driver store path
Browse files Browse the repository at this point in the history
Adjust copying of wchar[] array into std::wstring accounting for
bytes vs wchar.

Code queries windows adpater for driver store path.  The driver store path is
returned as array of wchar but was copied as bytes, resulting in copying from
unallocated memory.

This bug was introduced in #7679 and is present in MCDM drops starting M6.

Signed-off-by: Soren Soe <[email protected]>
  • Loading branch information
stsoe committed Dec 18, 2023
1 parent f0f31af commit 9ef88d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime_src/core/common/detail/windows/xilinx_xrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ struct adapter
if (query_info->Status != D3DDDI_QUERYREGISTRY_STATUS_SUCCESS)
throw std::runtime_error("D3DDDI_QUERYREGISTRY_STATUS_SUCCESS failed");

// Return the driver path
std::wstring wstr{query_info->OutputString, query_info->OutputString + output_value_size};
// Return the driver path.
// Account for OutputString being WCHAR[], whereas OutputValueSize is bytes
std::wstring wstr{query_info->OutputString, query_info->OutputString + output_value_size / sizeof(wchar_t)};
return replace_systemroot(utf8(wstr));
}
};
Expand Down

0 comments on commit 9ef88d9

Please sign in to comment.