[OpenCL] Fixes out of bounds read in reordering code in ILU0.

rowPerColor only has size numColors!
This commit is contained in:
Markus Blatt 2020-08-05 21:17:57 +02:00
parent da40f0200e
commit 8d3eac81a5

View File

@ -119,10 +119,9 @@ namespace bda
queue->enqueueWriteBuffer(s.invDiagVals, CL_TRUE, 0, mat->Nb * sizeof(double) * bs * bs, invDiagVals);
int *rowsPerColorPrefix = new int[numColors + 1];
int prefix = 0;
for (int i = 0; i < numColors + 1; ++i) {
rowsPerColorPrefix[i] = prefix;
prefix += rowsPerColor[i];
rowsPerColorPrefix[0] = 0;
for (int i = 0; i < numColors; ++i) {
rowsPerColorPrefix[i+1] =rowsPerColorPrefix[i] + rowsPerColor[i];
}
queue->enqueueWriteBuffer(s.rowsPerColor, CL_TRUE, 0, (numColors + 1) * sizeof(int), rowsPerColorPrefix);
delete[] rowsPerColorPrefix;