Crash Bug/Bad Memory Read in pqQueryDialog (vtkDataObjectTypes::GetClassNameFromTypeId also partly to blame)
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
When pqQueryDialog::populateSelectionType() is used before the pipeline has been updated a bad memory read occurs in VTK's vtkDataObjectTypes::GetClassNameFromTypeId because typeId is -1
Steps to reproduce: Create a Wavelet source. Do not click Apply. Select Menu>Find Data. In our Win7 debug build and official 3.14.1 release this causes a crash due to bad memory access.
The cause of the crash is that vtkPVDataInformation is not fully initialized (DataSetType is still -1). which leads to a later bad access:
pqQueryDialog::populateSelectionType() if(dataInfo->DataSetTypeIsA("vtkGraph")) vtkPVDataInformation::DataSetTypeIsA(const char* type) if (strcmp(type, this->GetDataSetTypeAsString()) == 0)
which calls GetDataSetTypeAsString with -1 vtkDataObjectTypes::GetClassNameFromTypeId(int type)
There are two bugs here. First, that vtkDataObjectTypes::GetClassNameFromTypeId's bounds check is incomplete: if (type < numClasses)
should be if (type >=0 && type < numClasses) to be more robust and prevent a bad memory access in the subsequent line- if (type < numClasses) { return vtkDataObjectTypesStrings[type]; } else { return "UnknownClass"; }
Secondly, on the Paraview side, the dialog should have been more robust when the source info is not yet available.
Best, Lawrence