jkvargas / russimp

Assimp bindings for Rust
Other
84 stars 27 forks source link

Loading FBX scene causes double free #55

Open AcrylicShrimp opened 1 year ago

AcrylicShrimp commented 1 year ago

First of all, thank for this amazing work!

I'm trying to load a FBX scene, but russimp is causing double free.

let scene = {
    let file = std::fs::read("...")
        .unwrap();
    russimp::scene::Scene::from_buffer(
        &file,
        vec![
            russimp::scene::PostProcess::JoinIdenticalVertices,
            russimp::scene::PostProcess::Triangulate,
            russimp::scene::PostProcess::SortByPrimitiveType,
            russimp::scene::PostProcess::SplitLargeMeshes,
            russimp::scene::PostProcess::ImproveCacheLocality,
            russimp::scene::PostProcess::OptimizeMeshes,
            russimp::scene::PostProcess::OptimizeGraph,
        ],
        "",
    )
    .unwrap()
};
my-app(25371,0x1fbef1e00) malloc: Double free of object 0x15c969cc0
my-app(25371,0x1fbef1e00) malloc: *** set a breakpoint in malloc_error_break to debug
fish: Job 1, 'cargo run' terminated by signal SIGABRT (Abort)

The error is coming from: https://github.com/jkvargas/russimp/blob/c6af3e213b83581356974ad7c59d1aff4e6902fd/src/scene.rs#L443

But when I try to load another FBX file, it loads without any issue. I think the actual problem is inside assimp lib. Should I report it in there instead? What do you think?

jkvargas commented 1 year ago

hi @AcrylicShrimp, I don't have much time to put on russimp right now. But I am open to accept pull requests. It is hard to say without going deep into it.

AcrylicShrimp commented 1 year ago

Ok! I'll investigate and make a PR if I can handle this problem. Thanks!