IOSSExodus tests raising segfault in assert
Changes made to vtkIOSSModel
in this commit allow raising a segfault error in an assert. The error comes from vtkNodeBlock
constructor in vtkIOSSModel.cxx:1011
. We get that issue when running tests TestIOSSExodusParallelWriter
and TestIOSSExodusWriterClip
and compiling in Debug mode (to allow assert).
auto* gids = vtkIdTypeArray::SafeDownCast(ds->GetPointData()->GetGlobalIds());
if (!gids && ds->GetNumberOfPoints() != 0)
{
throw std::runtime_error("point global IDs missing.");
}
const auto numPoints = ds->GetNumberOfPoints();
assert(gids->GetNumberOfTuples() == numPoints);
The assert causes a segfault because gids
can be nullptr. Maybe a ||
was wanted, or maybe this case was simply missed, but it can segfault. Without this condition change, we fall in the throw, which fails the tests too.
In short, there need to be a change made to this function to catch that case, and also one in the test I believe. Issue was found on this MR, and the tests were commented out. When this is fixed, please readd those tests and update TestIOSSExodusParallelWriter
to use vtkGenerateProcessIds
instead of vtkProcessIdScalars
(you may want to a look at TestIOSSExodusParitionedFiles
).