Skip to content

Commit 49a0fbf

Browse files
committed
add invalid id checks before accessing data structures indexed by cluster id
1 parent 15c5340 commit 49a0fbf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

vpr/src/base/clustered_netlist_utils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ void ClusterAtomsLookup::init_lookup() {
4848
for (auto atom_blk_id : atom_ctx.nlist.blocks()) {
4949
ClusterBlockId clb_index = atom_ctx.lookup.atom_clb(atom_blk_id);
5050

51-
cluster_atoms[clb_index].push_back(atom_blk_id);
51+
if (clb_index != ClusterBlockId::INVALID()) {
52+
cluster_atoms[clb_index].push_back(atom_blk_id);
53+
}
5254
}
5355
}
5456

vpr/src/pack/cluster_util.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,6 +3686,8 @@ void init_clb_atoms_lookup(vtr::vector<ClusterBlockId, std::unordered_set<AtomBl
36863686
for (auto atom_blk_id : atom_ctx.nlist.blocks()) {
36873687
ClusterBlockId clb_index = atom_ctx.lookup.atom_clb(atom_blk_id);
36883688

3689-
atoms_lookup[clb_index].insert(atom_blk_id);
3689+
if (clb_index != ClusterBlockId::INVALID()) {
3690+
atoms_lookup[clb_index].insert(atom_blk_id);
3691+
}
36903692
}
3691-
}
3693+
}

0 commit comments

Comments
 (0)