vtkGLTFReader crashes when bin file is missing
For gltf file linking to a bin file, if the bin file is missing then vtkGLTFReader segfaults.
To reproduce, use this data: BoxAnimated.gltf, then:
vtkNew<vtkGLTFReader> reader;
reader->SetFileName("BoxAnimated.gltf");
reader->Update();
The output displays a nice error message:
2023-06-26 16:32:21.012 ( 0.004s) [ F4F0DBC0]vtkGLTFDocumentLoaderIn:60 ERR| vtkGLTFDocumentLoader (0x5555555a7910): Invalid buffer.uri value for buffer
But it crashes later. Here the callstack:
1 __gnu_cxx::__normal_iterator<const char *, std::vector<char>>::__normal_iterator stl_iterator.h 1077 0x7ffff76d370a
2 std::vector<char>::begin stl_vector.h 881 0x7ffff76ceef4
3 (anonymous namespace)::ExtractAndCastCellBufferData<unsigned short> vtkGLTFDocumentLoader.cxx 509 0x7ffff76c8a82
4 vtkGLTFDocumentLoader::ExtractPrimitiveAccessorData vtkGLTFDocumentLoader.cxx 604 0x7ffff76bf2c8
5 vtkGLTFDocumentLoader::LoadModelData vtkGLTFDocumentLoader.cxx 930 0x7ffff76c2c32
6 vtkGLTFReader::RequestData vtkGLTFReader.cxx 828 0x7ffff7709f1f
7 vtkMultiBlockDataSetAlgorithm::ProcessRequest vtkMultiBlockDataSetAlgorithm.cxx 86 0x7ffff2caba5e
8 vtkExecutive::CallAlgorithm vtkExecutive.cxx 735 0x7ffff2c8b6d9
9 vtkDemandDrivenPipeline::ExecuteData vtkDemandDrivenPipeline.cxx 462 0x7ffff2c81852
10 vtkCompositeDataPipeline::ExecuteData vtkCompositeDataPipeline.cxx 163 0x7ffff2c7467d
11 vtkDemandDrivenPipeline::ProcessRequest vtkDemandDrivenPipeline.cxx 261 0x7ffff2c80da7
12 vtkStreamingDemandDrivenPipeline::ProcessRequest vtkStreamingDemandDrivenPipeline.cxx 344 0x7ffff2dc9860
13 vtkDemandDrivenPipeline::UpdateData vtkDemandDrivenPipeline.cxx 419 0x7ffff2c81623
14 vtkStreamingDemandDrivenPipeline::Update vtkStreamingDemandDrivenPipeline.cxx 418 0x7ffff2dc9c32
15 vtkStreamingDemandDrivenPipeline::Update vtkStreamingDemandDrivenPipeline.cxx 381 0x7ffff2dc9abb
16 vtkAlgorithm::Update vtkAlgorithm.cxx 1492 0x7ffff2c6974e
17 vtkAlgorithm::Update vtkAlgorithm.cxx 1486 0x7ffff2c69719
18 main main.cpp 16 0x55555555620a
Maybe related to some segfault reported here: #18809