Fix buffer overflow
Add check for bounds of sindex[] and rindex[]. Signed-off-by: Mikhail Kurnosov <mkurnosov@gmail.com>
Этот коммит содержится в:
родитель
5fceca235b
Коммит
44acc92104
@ -276,11 +276,13 @@ int mca_coll_spacc_allreduce_intra_redscat_allgather(
|
|||||||
rcount[step], dtype);
|
rcount[step], dtype);
|
||||||
|
|
||||||
/* Move the current window to the received message */
|
/* Move the current window to the received message */
|
||||||
|
if (step + 1 < nsteps) {
|
||||||
rindex[step + 1] = rindex[step];
|
rindex[step + 1] = rindex[step];
|
||||||
sindex[step + 1] = rindex[step];
|
sindex[step + 1] = rindex[step];
|
||||||
wsize = rcount[step];
|
wsize = rcount[step];
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Assertion: each process has 1 / p' of the total reduction result:
|
* Assertion: each process has 1 / p' of the total reduction result:
|
||||||
* rcount[nsteps - 1] elements in the rbuf[rindex[nsteps - 1], ...].
|
* rcount[nsteps - 1] elements in the rbuf[rindex[nsteps - 1], ...].
|
||||||
|
@ -291,12 +291,14 @@ int mca_coll_spacc_reduce_intra_redscat_gather(
|
|||||||
rcount[step], dtype);
|
rcount[step], dtype);
|
||||||
|
|
||||||
/* Move the current window to the received message */
|
/* Move the current window to the received message */
|
||||||
|
if (step + 1 < nsteps) {
|
||||||
rindex[step + 1] = rindex[step];
|
rindex[step + 1] = rindex[step];
|
||||||
sindex[step + 1] = rindex[step];
|
sindex[step + 1] = rindex[step];
|
||||||
wsize = rcount[step];
|
wsize = rcount[step];
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Assertion: each process has 1 / p' of the total reduction result:
|
* Assertion: each process has 1 / p' of the total reduction result:
|
||||||
* rcount[nsteps - 1] elements in the rbuf[rindex[nsteps - 1], ...].
|
* rcount[nsteps - 1] elements in the rbuf[rindex[nsteps - 1], ...].
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user