Merge pull request #2722 from blattms/fix-reorder-ilu0-opencl

[OpenCL] Fixes out of bounds read in reordering code in ILU0.
This commit is contained in:
Markus Blatt 2020-08-07 18:09:12 +02:00 committed by GitHub
commit c1effde738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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