KhronosGroup / SPIRV-Reflect

SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.
Apache License 2.0
672 stars 147 forks source link

segmentation fault when parsing shader containing buffer-references #271

Closed fabian-lunarg closed 1 month ago

fabian-lunarg commented 2 months ago

using spirv-reflect from latest vulkan-sdk-1.3.283.0 (or HEAD), ubuntu 22.04, x86_64:

spirv-reflect g_buffer_vert.spv
[1]    171736 segmentation fault (core dumped)  spirv-reflect

I'm almost sure this a regression, but could not bisect when it got introduced. the shader uses an array of buffer-references, which I believe is the trigger for the segfaults. other shaders containing the same pattern also segfault.

layout(buffer_reference, scalar) readonly buffer VertexBufferPtr { packed_vertex_t v[]; };
layout(binding = BINDING_VERTICES, set = 0, scalar) readonly buffer Vertices { VertexBufferPtr vertex_buffers[]; };

I'm able to hotfix with a simple nullptr-check, but unsure if there is more to be done (@spencer-lunarg ?). PR coming up

g_buffer_vert.zip