Commit a7bec72b authored by Cory Quammen's avatar Cory Quammen

Fix SpreadSheet View crash when column name is NULL

Protect against passing NULL to strcmp in a few places. Added test
that crashes before this change, but does not crash after this change.
parent 9f081b07
Pipeline #32469 passed with stage
......@@ -85,7 +85,9 @@ if (PARAVIEW_ENABLE_PYTHON)
${CMAKE_CURRENT_SOURCE_DIR}/DetachedFromLayoutIndirect.xml
${CMAKE_CURRENT_SOURCE_DIR}/TestPythonConsole.xml
${CMAKE_CURRENT_SOURCE_DIR}/TestPopOutWidget.xml # needs programmable filter
${CMAKE_CURRENT_SOURCE_DIR}/MultipleNumberOfComponents.xml)
${CMAKE_CURRENT_SOURCE_DIR}/MultipleNumberOfComponents.xml
${CMAKE_CURRENT_SOURCE_DIR}/SpreadSheetNullArrayName.xml # needs programmable filter
)
endif()
SET (TESTS_WITH_INLINE_COMPARES
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources" command="activate" arguments="SphereSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ProcessIdScalars" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ProgrammableFilter" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Script/1pqPopOutWidget0/Script" command="key" arguments="16777249" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Script/1pqPopOutWidget0/Script" command="set_string" arguments="inputPD = self.GetInput()&#xA;&#xA;newArray = vtk.vtkFloatArray()&#xA;newArray.SetName(None)&#xA;newArray.SetNumberOfComponents(1)&#xA;newArray.SetNumberOfTuples(inputPD.GetNumberOfPoints())&#xA;newArray.FillComponent(0, 2.3)&#xA;&#xA;outputPD = self.GetOutput()&#xA;outputPD.GetPointData().AddArray(newArray)" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mousePress" arguments="1,1,0,8,14" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mouseMove" arguments="1,0,0,7,15" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mouseRelease" arguments="1,0,0,7,15" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_tabbar" command="set_tab_with_text" arguments="+" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/EmptyView/scrollArea/qt_scrollarea_viewport/widgetFoo/ConvertActionsFrame/SpreadSheetView" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/pqSpreadSheetViewDecorator/Attribute" command="activated" arguments="Cell Data" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/pqSpreadSheetViewDecorator/Attribute" command="activated" arguments="Point Data" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/pqSpreadSheetViewDecorator/Attribute" command="activated" arguments="Cell Data" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/pqSpreadSheetViewDecorator/Source" command="activated" arguments="ProgrammableFilter1" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/pqSpreadSheetViewDecorator/Attribute" command="activated" arguments="Point Data" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0/1QHeaderView1" command="mousePress" arguments="1,1,0,0,0,1" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0/1QHeaderView1" command="mouseRelease" arguments="1,0,0,0,0,1" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0/1QHeaderView1" command="mousePress" arguments="1,1,0,0,0,1" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget2/Frame.0/CentralWidgetFrame/Viewport/1pqSpreadSheetViewWidget0/1QHeaderView1" command="mouseRelease" arguments="1,0,0,0,0,1" />
</pqevents>
......@@ -441,7 +441,7 @@ QVariant pqSpreadSheetViewModel::data(const QModelIndex& idx, int role /*=Qt::Di
{
// Don't show ASCII characted for char arrays.
const char* column_name = view->GetColumnName(column);
if (strcmp(column_name, "Cell Type") == 0)
if (column_name && strcmp(column_name, "Cell Type") == 0)
{
return getCellTypeAsString(value.ToInt());
}
......@@ -538,7 +538,8 @@ bool pqSpreadSheetViewModel::isSortable(int section)
vtkSpreadSheetView* view = this->GetView();
if (view->GetNumberOfColumns() > section)
{
return strcmp(view->GetColumnName(section), "Structured Coordinates") != 0;
const char* columnName = view->GetColumnName(section);
return columnName && strcmp(columnName, "Structured Coordinates") != 0;
}
return false;
......
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