Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent reading beyond bounds of p_access_chain. #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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: 7 additions & 6 deletions spirv_reflect.c
Original file line number Diff line number Diff line change
Expand Up @@ -2252,14 +2252,15 @@ static SpvReflectResult ParseDescriptorBlockVariableUsage(
return SPV_REFLECT_RESULT_ERROR_SPIRV_UNEXPECTED_BLOCK_DATA;
}

uint32_t index = p_access_chain->indexes[index_index];
if (index_index < p_access_chain->index_count) {
uint32_t index = p_access_chain->indexes[index_index];

if (index >= p_var->member_count) {
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_BLOCK_MEMBER_REFERENCE;
}
if (index >= p_var->member_count) {
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_BLOCK_MEMBER_REFERENCE;
}

SpvReflectBlockVariable* p_member_var = &p_var->members[index];

SpvReflectBlockVariable* p_member_var = &p_var->members[index];
if (index_index < p_access_chain->index_count) {
SpvReflectResult result = ParseDescriptorBlockVariableUsage(
p_parser,
p_module,
Expand Down