Skip to content

Commit 564038b

Browse files
litghostkmurray
authored andcommitted
Check that cost_index fits within storage.
Signed-off-by: Keith Rothman <[email protected]>
1 parent 4219024 commit 564038b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vpr/src/route/rr_node.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ void t_rr_node::set_class_num(short new_class_num) {
201201
}
202202

203203
void t_rr_node::set_cost_index(size_t new_cost_index) {
204+
if (new_cost_index >= std::numeric_limits<decltype(cost_index_)>::max()) {
205+
VPR_THROW(VPR_ERROR_ROUTE, "Attempted to set cost_index_ %zu above cost_index storage max value.",
206+
new_cost_index);
207+
}
204208
cost_index_ = new_cost_index;
205209
}
206210

0 commit comments

Comments
 (0)