Crash or bug in ParaView when Catalyst sends a vtkImageData having a vtkVariant field data constructed with a 0 coded int8_t or uint8_t
It's a bug I discovered last year.
To reproduce it, in the adaptor part of Catalyst, you can use this snippet :
vtkSmartPointer<vtkImageData> Grid; // the image data to be sent to paraview //... allocation, constructing, putting some data in the Grid... // here I want to add an "array" to the vtkFieldData of "Grid" int8_t test = 0; // with uint8_t we will have a bug instead of a crash, see details below const vtkVariant metaDataValue = test; // I did this as actually I'm using a function to add field data // and this last has a vtkVariant parameter vtkSmartPointer<vtkVariantArray> metaDataArray = vtkSmartPointer<vtkVariantArray>::New(); metaDataArray->SetName("Kitware"); metaDataArray->SetNumberOfValues(1); metaDataArray->SetValue(0, metaDataValue); Grid->GetFieldData()->AddArray(metaDataArray);
The crash/bug occur when "test" is equal to 0 :
- If test is a int8_t, ParaView will crash. I remember that the crash occur where the data is deserialized after receiving data from the socket.
- If test is an uint8_t, in Paraview's spreadsheet view will display 48 (the ASCII code of character '0' by the way) for the field data "test". It looks like a nasty bug.
I don't know how vtk data objects are marshalled/unmarshalled to be sent in the network, otherwise, I would fix it the bug myself. I tried but the code isn't very clear. (by the way, if someone can explain to me the principle that would be great for my knowledge).