Skip to content

Commit

Permalink
Fix overflow when calling parsec_data_create
Browse files Browse the repository at this point in the history
  • Loading branch information
Qinglei Cao committed Mar 15, 2024
1 parent 4f76b6d commit 6daca66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion parsec/data_dist/matrix/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <mpi.h>
#endif
#include <string.h>
#include <limits.h>

static parsec_data_key_t tiled_matrix_data_key(struct parsec_data_collection_s *desc, ...);

Expand All @@ -35,7 +36,7 @@ parsec_tiled_matrix_create_data(parsec_tiled_matrix_t* matrix,
assert( pos <= matrix->nb_local_tiles );
return parsec_data_create( matrix->data_map + pos,
&(matrix->super), key, ptr,
matrix->bsiz * parsec_datadist_getsizeoftype(matrix->mtype),
(size_t)matrix->bsiz * parsec_datadist_getsizeoftype(matrix->mtype),
PARSEC_DATA_FLAG_PARSEC_MANAGED);
}

Expand Down Expand Up @@ -95,6 +96,7 @@ void parsec_tiled_matrix_init( parsec_tiled_matrix_t *tdesc,
tdesc->mb = mb;
tdesc->nb = nb;
tdesc->bsiz = mb * nb;
assert((size_t)mb * nb <= INT_MAX);

/* Large matrix parameters */
tdesc->lm = lm;
Expand Down

0 comments on commit 6daca66

Please sign in to comment.