vtkJSONDataSetWriter crashes when CellData contains StringArray

Hello,

The vtkJSONDataSetWriter seems to have an issue, when the DataSet contains cell data with non-vtkDataArray (e.g. StringArray). This kind of DataSet causes Paraview to crash during “Export Scene”.

Here is the test file that caused the issue:
test_withStringArray.vtu (2.5 KB)

To reproduce this issue:

  1. Load test_withStringArray.vtu into Paraview 5.7.0
  2. Export the scene as vtkjs
  3. Paraview crashes

The core dump ends with these lines:

18 0x7f3211290b91 vtkJSONSceneExporter::WriteData() + 737
17 0x7f321128f51f vtkJSONSceneExporter::WriteDataObject(std::ostream&, vtkDataObject*, vtkActor*) + 431
16 0x7f321128f3e8 vtkJSONSceneExporter::WriteDataObject(std::ostream&, vtkDataObject*, vtkActor*) + 120
15 0x7f321128d5e3 vtkJSONSceneExporter::WriteDataSet(vtkDataSet*, char const*) + 1779
14 0x7f320a5f350c vtkWriter::Write() + 44
13 0x7f3206448344 vtkStreamingDemandDrivenPipeline::UpdateWholeExtent() + 356
12 0x7f32064491ef vtkStreamingDemandDrivenPipeline::Update(int, vtkInformationVector*) + 255
11 0x7f320640a2aa vtkDemandDrivenPipeline::UpdateData(int) + 138
10 0x7f3206447c91 vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) + 801
9 0x7f320640b777 vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) + 1447
8 0x7f3206405dd1 vtkCompositeDataPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) + 257
7 0x7f3206408bd7 vtkDemandDrivenPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) + 55
6 0x7f320640e640 vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) + 64
5 0x7f320a5f366c vtkWriter::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) + 92
4 0x7f321128afa4 vtkJSONDataSetWriter::WriteData() + 2340
3 0x7f3211289ecf vtkJSONDataSetWriter::WriteDataSetAttributes(vtkDataSetAttributes*, char const*) + 943
2 0x7f32112887bc vtkJSONDataSetWriter::WriteArray(vtkDataArray*, char const*, char const*) + 76
1 0x7f3211287f54 vtkJSONDataSetWriter::GetUID(vtkDataArray*, bool&) + 20
0 0x7f3217c74f20 /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f3217c74f20]
( 27.195s) [paraview ] :0 FATL| Signal: SIGSEGV

Regards
Lukas

Thanks Lukas for reporting the issue, I’ll see what I can do to make sure the StringArrays get skipped for now.

This PR will take care of it.