vkd3d/libs/vkd3d-shader
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
..
checksum.c vkd3d-shader: Introduce vkd3d_make_u{16, 32}() helpers. 2021-08-11 20:58:24 +02:00
d3d_asm.c vkd3d-shader/dxil: Implement DX intrinsic WavePrefixBitCount. 2024-05-13 11:50:22 +02:00
d3dbc.c vkd3d-shader/d3dbc: Write used bind count for numeric uniforms. 2024-05-13 22:26:13 +02:00
dxbc.c vkd3d-shader: Move shader signatures to vsir_program. 2024-03-11 22:09:31 +01:00
dxil.c vkd3d-shader/dxil: Implement DX intrinsic WavePrefixBitCount. 2024-05-13 11:50:22 +02:00
fx.c vkd3d-shader/fx: Initial support for writing sample state objects. 2024-05-08 21:08:05 +02:00
glsl.c vkd3d-shader/glsl: Implement VKD3DSIH_NOP. 2024-04-22 23:14:30 +02:00
hlsl_codegen.c vkd3d-shader/hlsl: Allocate SM1 numeric uniforms in decreasing bind count. 2024-05-13 22:26:21 +02:00
hlsl_constant_ops.c vkd3d-shader/hlsl: Move the "base_type" member to the class-specific union. 2024-05-06 22:12:41 +02:00
hlsl.c vkd3d-shader/hlsl: Turn hlsl_state_block_entry arguments into hlsl_src. 2024-05-08 21:07:57 +02:00
hlsl.h vkd3d-shader/hlsl: Track bind count according to usage for uniforms. 2024-05-13 22:26:07 +02:00
hlsl.l vkd3d-shader/hlsl: Allow 'export' modifier on functions. 2024-04-03 22:24:15 +02:00
hlsl.y vkd3d-shader/hlsl: Turn hlsl_state_block_entry arguments into hlsl_src. 2024-05-08 21:07:57 +02:00
ir.c vkd3d-shader/ir: Validate geometry shader properties. 2024-05-08 21:08:15 +02:00
libvkd3d-shader.pc.in build: Build libvkd3d-shader as public library. 2018-11-02 11:19:00 +01:00
preproc.h build: Make the default symbol visibility "hidden". 2021-08-09 21:43:22 +02:00
preproc.l vkd3d-shader/preproc: Append spaces between tokens in macro invocations. 2023-08-02 20:19:21 +09:00
preproc.y vkd3d-shader/hlsl: Handle over/underflow when parsing integer literals. 2022-05-12 19:33:56 +02:00
spirv.c vkd3d-shader/spirv: Implement the WAVE_PREFIX_BIT_COUNT instruction. 2024-05-13 11:50:23 +02:00
tpf.c vkd3d-shader/tpf: Write the field offset in bytes. 2024-05-06 22:12:48 +02:00
vkd3d_shader_main.c vkd3d-shader: Return a valid pointer when count=0 in param allocator (ubsan). 2024-05-13 22:27:13 +02:00
vkd3d_shader_private.h vkd3d-shader/dxil: Implement DX intrinsic WavePrefixBitCount. 2024-05-13 11:50:22 +02:00
vkd3d_shader.map vkd3d-shader: Implement scanning combined resource/sampler information. 2023-11-13 23:19:23 +01:00