Skip to content

Commit

Permalink
Merge pull request #91312 from DarioSamo/render_graph_asan
Browse files Browse the repository at this point in the history
Fix incorrect memory read when capacity changes in RD Graph.
  • Loading branch information
akien-mga committed Apr 30, 2024
2 parents 3d03d73 + 21bd59c commit 4fb0c00
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions servers/rendering/rendering_device_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,19 @@ void RenderingDeviceGraph::_add_command_to_graph(ResourceTracker **p_resource_tr
// We add this command to the adjacency list of all commands that were reading from the entire resource.
int32_t read_full_command_list_index = search_tracker->read_full_command_list_index;
while (read_full_command_list_index >= 0) {
const RecordedCommandListNode &command_list_node = command_list_nodes[read_full_command_list_index];
if (command_list_node.command_index == p_command_index) {
int32_t read_full_command_index = command_list_nodes[read_full_command_list_index].command_index;
int32_t read_full_next_index = command_list_nodes[read_full_command_list_index].next_list_index;
if (read_full_command_index == p_command_index) {
if (!resource_has_parent) {
// Only slices are allowed to be in different usages in the same command as they are guaranteed to have no overlap in the same command.
ERR_FAIL_MSG("Command can't have itself as a dependency.");
}
} else {
// Add this command to the adjacency list of each command that was reading this resource.
_add_adjacent_command(command_list_node.command_index, p_command_index, r_command);
_add_adjacent_command(read_full_command_index, p_command_index, r_command);
}

read_full_command_list_index = command_list_node.next_list_index;
read_full_command_list_index = read_full_next_index;
}

if (!resource_has_parent) {
Expand Down

0 comments on commit 4fb0c00

Please sign in to comment.