Skip to content

There was a crash when loading the GLB file, and I’ve included the code defect below. #9402

@jellychen

Description

@jellychen

pool.glb.zip

When loading this GLB file, a crash occurred. After investigation, I found that there’s a pointer in this file that isn’t properly checked for validity.

filament/libs/gltfio/src/ResourceLoader.cpp

std::pair<Texture*, CacheResult> ResourceLoader::Impl::getOrCreateTexture(FFilamentAsset* asset, size_t textureIndex, TextureProvider::TextureFlags flags) { const cgltf_texture& srcTexture = asset->mSourceAsset->hierarchy->textures[textureIndex]; const cgltf_image* image = srcTexture.basisu_image ? srcTexture.basisu_image : srcTexture.image; const cgltf_buffer_view* bv = image->buffer_view; const char* uri = image->uri;

const cgltf_image* image

The image here might be invalid. After I added a validity check, the crash no longer occurred. However, I’m not sure if this kind of direct check could cause other issues — I’ll leave it to the professionals to evaluate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions