mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-compiler: Default to VKD3D_SHADER_SOURCE_HLSL when the source size is smaller than a uint32_t.
For example, when the input is an empty file. Leaving the source type as VKD3D_SHADER_SOURCE_NONE would cause (potential) subsequent get_source_type_info() calls to return NULL, resulting in a segmentation fault. Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a021b0a7d3
commit
4093fe49bf
@ -663,11 +663,11 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
|
|
||||||
if (options.preprocess_only)
|
if (options.preprocess_only || info.source.size < sizeof(token))
|
||||||
{
|
{
|
||||||
options.source_type = VKD3D_SHADER_SOURCE_HLSL;
|
options.source_type = VKD3D_SHADER_SOURCE_HLSL;
|
||||||
}
|
}
|
||||||
else if (info.source.size >= sizeof(token))
|
else
|
||||||
{
|
{
|
||||||
memcpy(&token, info.source.code, sizeof(token));
|
memcpy(&token, info.source.code, sizeof(token));
|
||||||
if (token == TAG_DXBC)
|
if (token == TAG_DXBC)
|
||||||
|
Loading…
Reference in New Issue
Block a user