1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[d3d11] Fix GetData parameter validation

We're supposed to return an error if a null pointer is
passed along with a non-zero DataSize. Fixes more wine
test failures.
This commit is contained in:
Philip Rebohle 2019-06-16 19:24:44 +02:00
parent 43389d8ef4
commit 684355dfca
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -60,21 +60,16 @@ namespace dxvk {
void* pData,
UINT DataSize,
UINT GetDataFlags) {
if (!pAsync)
if (!pAsync || (DataSize && !pData))
return E_INVALIDARG;
// Make sure that we can safely write to the memory
// location pointed to by pData if it is specified.
if (DataSize == 0)
pData = nullptr;
if (pData && pAsync->GetDataSize() != DataSize) {
Logger::err(str::format(
"D3D11: GetData: Data size mismatch",
"\n Expected: ", pAsync->GetDataSize(),
"\n Got: ", DataSize));
// Check whether the data size is actually correct
if (DataSize && DataSize != pAsync->GetDataSize())
return E_INVALIDARG;
}
// Passing a non-null pData is actually allowed if
// DataSize is 0, but we should ignore that pointer
pData = DataSize ? pData : nullptr;
// Ensure that all query commands actually get
// executed before trying to access the query