From: Henri Verbeet hverbeet@codeweavers.com
--- libs/vkd3d-utils/vkd3d_utils_main.c | 6 ++++++ tests/hlsl_d3d12.c | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
diff --git a/libs/vkd3d-utils/vkd3d_utils_main.c b/libs/vkd3d-utils/vkd3d_utils_main.c index b0c025f46..e7985e3c1 100644 --- a/libs/vkd3d-utils/vkd3d_utils_main.c +++ b/libs/vkd3d-utils/vkd3d_utils_main.c @@ -537,6 +537,12 @@ HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
TRACE("data_size %lu, blob %p.\n", data_size, blob);
+ if (!blob) + { + WARN("Invalid 'blob' pointer specified.\n"); + return D3DERR_INVALIDCALL; + } + if (!(data = vkd3d_calloc(data_size, 1))) return E_OUTOFMEMORY;
diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c index ff29f1f73..de3737f6e 100644 --- a/tests/hlsl_d3d12.c +++ b/tests/hlsl_d3d12.c @@ -20,6 +20,10 @@ #include "d3d12_crosstest.h" #include "vkd3d_common.h"
+#ifndef D3DERR_INVALIDCALL +#define D3DERR_INVALIDCALL 0x8876086c +#endif + struct test_options test_options = {0};
#define check_preprocess(a, b, c, d, e) check_preprocess_(__LINE__, a, b, c, d, e) @@ -602,6 +606,25 @@ static void test_thread_id(void) destroy_test_context(&context); }
+static void test_create_blob(void) +{ + unsigned int refcount; + ID3D10Blob *blob; + HRESULT hr; + + hr = D3DCreateBlob(1, NULL); + ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr); + + hr = D3DCreateBlob(0, NULL); + ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr); + + hr = D3DCreateBlob(0, &blob); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + refcount = ID3D10Blob_Release(blob); + ok(!refcount, "Got refcount %u.\n", refcount); +} + START_TEST(hlsl_d3d12) { parse_args(argc, argv); @@ -610,4 +633,5 @@ START_TEST(hlsl_d3d12)
run_test(test_preprocess); run_test(test_thread_id); + run_test(test_create_blob); }