Skip to content

Commit 40b1e12

Browse files
author
Christos Konstantinos Matzoros
committed
Correction to test for overflow in mtx reader
1 parent 8223481 commit 40b1e12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/osp/auxiliary/io/mtx_graph_file_reader.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ bool readComputationalDagMartixMarketFormat(std::ifstream& infile, Graph_t& grap
6969
return false;
7070
}
7171

72-
const vertex_t num_nodes = static_cast<vertex_t>(M_row);
73-
if (num_nodes > std::numeric_limits<vertex_t>::max()) {
72+
if (static_cast<unsigned long long>(M_row) > std::numeric_limits<vertex_t>::max()) {
7473
std::cerr << "Error: Matrix dimension too large for vertex type.\n";
7574
return false;
7675
}
7776

77+
const vertex_t num_nodes = static_cast<vertex_t>(M_row);
7878
std::vector<int> node_work_wts(num_nodes, 0);
7979
std::vector<int> node_comm_wts(num_nodes, 1);
8080

0 commit comments

Comments
 (0)