Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions spirv_reflect.c
Original file line number Diff line number Diff line change
Expand Up @@ -3572,9 +3572,16 @@ static SpvReflectResult ParseStaticallyUsedResources(SpvReflectPrvParser* p_pars
++j;
}

memcpy(&p_used_accesses[used_acessed_count], p_parser->functions[j].accessed_variables,
p_parser->functions[j].accessed_variable_count * sizeof(SpvReflectPrvAccessedVariable));
used_acessed_count += p_parser->functions[j].accessed_variable_count;
SpvReflectPrvFunction* p_function = &p_parser->functions[j];

// Prevent NULL from being passed to memcpy, which is UB
if (p_function->accessed_variable_count == 0) {
continue;
}

memcpy(&p_used_accesses[used_acessed_count], p_function->accessed_variables,
p_function->accessed_variable_count * sizeof(SpvReflectPrvAccessedVariable));
used_acessed_count += p_function->accessed_variable_count;
}
SafeFree(p_called_functions);

Expand Down