Skip to content
Snippets Groups Projects
Commit da8c9332 authored by David C. Lonie's avatar David C. Lonie
Browse files

Triage PSLAC reader problems.

There's a bug in the reader that result in invalid memory accesses from
trying to read data out of an empty array. This patch prevents the
invalid reads and prints a warning when the error state is detected.
parent dd1d13d1
No related branches found
No related tags found
No related merge requests found
......@@ -1062,6 +1062,19 @@ int vtkPSLACReader::ReadMidpointCoordinates (
start /= this->Internal->EdgesToSendToProcesses->GetNumberOfComponents();
end /= this->Internal->EdgesToSendToProcesses->GetNumberOfComponents();
// FIXME: There seems to be a bug somewhere that results in the
// EdgesToSendToProcesses array to be empty, while the corresponding
// Offsets and Lengths arrays are not. This only happens on some processes,
// and the PSLAC unit tests still pass. The bit below prevents invalid
// memory accesses when this occurs.
if (this->Internal->EdgesToSendToProcesses->GetNumberOfTuples() == 0 &&
this->Internal->EdgesToSendToProcessesOffsets->GetNumberOfTuples() != 0)
{
vtkWarningMacro("Inconsistent reader state detected. Skipping midpoint "
"sync.");
end = start = 0;
}
midpointListsType midpointsToSend;
for (vtkIdType i = start; i < end; i ++)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment