vkd3d/libs
Francisco Casas 5b7191280b vkd3d-shader: Return a valid pointer when count=0 in param allocator (ubsan).
After compiling and linking with '-fsanitize=undefined' the following
error pops up in many tests:

    vkd3d_shader_main.c:2024:12: runtime error: member access within null pointer of type 'struct vkd3d_shader_param_node'

This happens in the scenario where shader_param_allocator_get() gets
called with 'count = 0' but no allocation has been made yet, so
allocator->current is NULL.

In this case the result of the function, given by:

    params = &allocator->current->param[allocator->index * allocator->stride];

is an invalid non-NULL pointer.

Functions like shader_sm4_read_instruction() may call
vsir_program_get_src_params() or vsir_program_get_dst_params() with 0
counts for various DCL_ instructions, as well as things like NOP,
ELSE, and SYNC.

We could avoid calling the functions in question with 0 counts, but it
doesn't seem worth the effort.

Alternatively, we could just return NULL on 'count == 0', but this is
also complicated because NULL is interpreted as a memory allocation
failure on the callers.

So we force allocation of the next node even if 'count = 0' when
allocator->current is NULL.
2024-05-13 22:27:13 +02:00
..
vkd3d vkd3d: Handle D3D12_FEATURE_D3D12_OPTIONS18 in CheckFeatureSupport(). 2024-05-13 11:50:37 +02:00
vkd3d-common vkd3d: Implement vkd3d_shader_cache_get. 2024-04-24 23:49:20 +02:00
vkd3d-shader vkd3d-shader: Return a valid pointer when count=0 in param allocator (ubsan). 2024-05-13 22:27:13 +02:00
vkd3d-utils vkd3d-utils: Implement ID3D12ShaderReflection::GetResourceBindingDesc(). 2024-05-06 22:12:50 +02:00
.gitignore libs/vkd3d: Trace build version. 2018-06-27 22:43:49 +02:00