Commit 823abd3c authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Fixed BUG #12788. Segfault when reading files with multiple pieces.

The bug was introduced by 4f54be9b. The computation of the locations offset was
incorrect (we were missing taking into account the location for placing the
count for items in the cell). Fixed that.
parent 73ab66ba
......@@ -282,8 +282,14 @@ int vtkXMLUnstructuredGridReader::ReadPieceData()
{
// this set the startLoc to point to the location in the cellArray where the
// cell for this piece will start writing.
startLoc = locations->GetValue(this->StartCell-1) +
cellArrayData->GetValue(locations->GetValue(this->StartCell-1));
// Id for last written cell:
vtkIdType lastWrittenCell = this->StartCell - 1;
vtkIdType locationOfLastWrittenCell = locations->GetValue(lastWrittenCell);
startLoc = locationOfLastWrittenCell + 1 +
cellArrayData->GetValue(locationOfLastWrittenCell);
// startLoc = location-of-last-written-cell + 1 (for put the count for items in the cell)
// + (number of items in the cell).
}
vtkIdType* begin = output->GetCells()->GetData()->GetPointer(startLoc);
vtkIdType* cur = begin;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment