tests/shader_runner: Pass the correct buffer size to swprintf() in dxc_compiler_compile_shader().

swprintf() expects the length of the buffer in WCHARs instead of bytes,
so ARRAY_SIZE() is used instead of sizeof().

This caused almost all tests to terminate abruptly with the following
message, in my machine:

*** buffer overflow detected ***: terminated
This commit is contained in:
Francisco Casas
2025-01-29 16:39:44 -03:00
committed by Henri Verbeet
parent f1412e422c
commit 0f7bb922ba
Notes: Henri Verbeet 2025-02-03 16:39:55 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1364

View File

@ -1623,7 +1623,7 @@ static HRESULT dxc_compiler_compile_shader(void *dxc_compiler, const char *profi
*blob_out = NULL;
swprintf(wprofile, sizeof(wprofile), L"%hs", profile);
swprintf(wprofile, ARRAY_SIZE(wprofile), L"%hs", profile);
if (FAILED(hr = dxc_compile(dxc_compiler, wprofile, compile_options, enable_16bit_types, hlsl, &blob)))
return hr;