The "header->buffer_count \* sizeof(\*rdef_buffers)" multiplication can overflow, but when it does, the vkd3d_calloc() call will fail by virtue of sizeof(\*reflection->buffers) being the same size as or larger than sizeof(\*rdef_buffers). I suppose that works, but it seems a bit unfortunate/fragile.
vkd3d-shader's require_space() doesn't have that issue. Perhaps we can do better than require_space(), but I'm not immediately convinced get_section_data() is it.
Eh, I wasn't aware of require_space(). I'll copy it into get_section_data(). I do like get_section_data() as a helper in general though, which is to say I like having a function that just returns a pointer to a strongly typed struct. If you dislike it I'll revert to the pattern in dxbc.c, though.
It also seems somewhat undesirable to have to pass vkd3d_shader_dxbc_section_desc structures around, instead of e.g. vkd3d_shader_code structures.
Good point.
Is that the right behaviour for inputs with multiple RDEF sections?
No, it was just yet another thing copied directly from Wine. I'll add a FIXME. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/626#note_60334