Skip to content

Commit e689a3a

Browse files
committed
coll/tuned: Sanitize NCOMSIZES during file read
Addresses Coverity 1646443
1 parent 2f9d1d2 commit e689a3a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ompi/mca/coll/tuned/coll_tuned_dynamic_file.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,11 @@ static int ompi_coll_tuned_read_rules_config_file_classic (char *fname, ompi_col
494494
}
495495
opal_output_verbose(25, ompi_coll_tuned_stream,
496496
"Read communicator count %ld for dynamic rule for collective ID %ld\n", NCOMSIZES, COLID);
497+
if( NCOMSIZES > INT_MAX) {
498+
opal_output_verbose(25, ompi_coll_tuned_stream,
499+
"Refusing to proceed: suspiciously large number found for the number of communicator-based rules: %ld\n", NCOMSIZES);
500+
goto on_file_error;
501+
}
497502
alg_p->n_com_sizes = NCOMSIZES;
498503
alg_p->com_rules = ompi_coll_tuned_mk_com_rules (NCOMSIZES, COLID);
499504
if (NULL == alg_p->com_rules) {

0 commit comments

Comments
 (0)