mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
vkd3d-utils: Check for a NULL 'blob' pointer in D3DCreateBlob().
This commit is contained in:
parent
eaf35c394d
commit
47d4097efa
Notes:
Alexandre Julliard
2023-10-16 23:02:26 +02:00
Approved-by: Matteo Bruni (@Mystral) Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/405
@ -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;
|
||||
|
||||
|
@ -31,4 +31,8 @@
|
||||
#include "vkd3d_memory.h"
|
||||
#include <vkd3d_utils.h>
|
||||
|
||||
#ifndef D3DERR_INVALIDCALL
|
||||
#define D3DERR_INVALIDCALL _HRESULT_TYPEDEF_(0x8876086c)
|
||||
#endif
|
||||
|
||||
#endif /* __VKD3D_UTILS_PRIVATE_H */
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user