Skip to content

Commit

Permalink
fix : Fix flexible array member allocation
Browse files Browse the repository at this point in the history
Corrected allocation of `nccl_net_ofi_schedule_t` to account for
flexible array member. The previous implementation did not allocate
enough memory for the flexible array `xfer_info` elements, leading to
potential out-of-bounds access.
  • Loading branch information
arunkarthik-akkart committed Oct 6, 2024
1 parent bad74fc commit 28ff1e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/unit/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int verify_schedule(nccl_net_ofi_schedule_t *schedule, nccl_net_ofi_schedule_t *
int create_ref_schedule(nccl_net_ofi_schedule_t **schedule, int num_xfer_infos)
{
int ret = 0;
*schedule = (nccl_net_ofi_schedule_t *)malloc(sizeof(nccl_net_ofi_xfer_info_t) +
*schedule = (nccl_net_ofi_schedule_t *)malloc(sizeof(nccl_net_ofi_schedule_t) +
num_xfer_infos * sizeof(nccl_net_ofi_xfer_info_t));

if (!(*schedule)) {
Expand Down

0 comments on commit 28ff1e9

Please sign in to comment.