intel/aub_viewer: catch invalid sampler state pointer

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9707>
This commit is contained in:
Marcin Ślusarz
2021-03-19 11:31:30 +01:00
committed by Marge Bot
parent 08f8677b29
commit 2b5f9602b7
+9 -2
View File
@@ -270,14 +270,21 @@ dump_samplers(struct aub_viewer_decode_ctx *ctx, uint32_t offset, int count)
return;
}
const unsigned sampler_state_size = strct->dw_length * 4;
if (count * sampler_state_size >= bo.size) {
ImGui::TextColored(ctx->cfg->missing_color, "sampler state ends after bo ends");
return;
}
for (int i = 0; i < count; i++) {
if (ImGui::TreeNodeEx(state_map, ImGuiTreeNodeFlags_Framed,
"sampler state %d", i)) {
aub_viewer_print_group(ctx, strct, state_addr, state_map);
ImGui::TreePop();
}
state_addr += 16;
state_map += 16;
state_addr += sampler_state_size;
state_map += sampler_state_size;
}
}