Closed mcooley closed 1 month ago
Describe the bug createAsset crashes when given content that's valid JSON, but invalid GLTF.
createAsset
To Reproduce
Engine* engine = Engine::create(); MaterialProvider* materialProvider = createUbershaderProvider(engine, UBERARCHIVE_DEFAULT_DATA, UBERARCHIVE_DEFAULT_SIZE); ResourceLoader* resourceLoader = new ResourceLoader(ResourceConfiguration{ .engine = engine }); AssetLoader* assetLoader = AssetLoader::create({ engine, materialProvider }); std::string validJsonInvalidGLTF = "{ \"invalid\": \"gltf\" }"; FilamentAsset* asset = assetLoader->createAsset(reinterpret_cast<uint8_t*>(validJsonInvalidGLTF.data()), validJsonInvalidGLTF.size());
With Filament 1.51.8, this program logs "There is no scene in the asset." to console, and then hits an access violation.
Expected behavior Print an error to console, and createAsset should return nullptr without crashing.
Logs Call stack:
filament_test.exe!std::copy_n<filament::gltfio::FFilamentInstance * *,unsigned __int64,filament::gltfio::FilamentInstance * *>(filament::gltfio::FFilamentInstance * * _First, unsigned __int64 _Count_raw, filament::gltfio::FilamentInstance * * _Dest) Line 4217 C++ filament_test.exe!filament::gltfio::FAssetLoader::createInstancedAsset(const unsigned char * bytes, unsigned int byteCount, filament::gltfio::FilamentInstance * * instances, unsigned __int64 numInstances) Line 369 C++ filament_test.exe!filament::gltfio::FAssetLoader::createAsset(const unsigned char * bytes, unsigned int byteCount) Line 315 C++ filament_test.exe!filament::gltfio::AssetLoader::createAsset(const unsigned char * bytes, unsigned int nbytes) Line 1617 C++ filament_test.exe!main(int argc, char * * argv) Line 22 C++
Desktop (please complete the following information):
Describe the bug
createAsset
crashes when given content that's valid JSON, but invalid GLTF.To Reproduce
With Filament 1.51.8, this program logs "There is no scene in the asset." to console, and then hits an access violation.
Expected behavior Print an error to console, and
createAsset
should return nullptr without crashing.Logs Call stack:
Desktop (please complete the following information):