Skip to content

Fix double free when the mesh contains duplicate bones. - #4944

Closed
dmarcinkovic wants to merge 1 commit into
assimp:masterfrom
DeepARSDK:bone-double-free
Closed

dmarcinkovic wants to merge 1 commit into
assimp:masterfrom
DeepARSDK:bone-double-free

Conversation

@dmarcinkovic

Copy link
Copy Markdown

The aiMesh class destructor iterates the array of bones and deletes them.
In the case of duplicate bones, the same bone is attempted to be deleted twice which causes the 'double free or corruption error.
We can store bones in the set and delete each bone only once.

@cstdbool

Copy link
Copy Markdown

Noticed this bug with FBX files which have bones with duplicate names.

@kimkulling

Copy link
Copy Markdown
Member

I am not able to update your branch. Could you do this, please? That would help a lot.

@kimkulling

kimkulling commented Mar 17, 2023 •

Copy link
Copy Markdown
Member

I see that the problem exists and that we need a solution for that. Unfortunately, this solution will only work for c++. The stuff gets inlined only when we are using a c++ compiler.

@turol

turol commented Mar 17, 2023

Copy link
Copy Markdown
Member

Why are there duplicate bones in the first place? Can we just define that bones must be unique and fix any loaders that create duplicates?

@dmarcinkovic

dmarcinkovic commented Mar 18, 2023 •

Copy link
Copy Markdown
Author

I will update the branch and I'll try to provide a solution that will work with the other compilers as well.

@dmarcinkovic

Copy link
Copy Markdown
Author

@turol, I got a double free or corruption error when I tried to import an fbx created with the Autodesk Maya tool.
I do agree that the Assimp library should refuse to load an fbx file when the mesh contains duplicate bones, and it is exactly what Assimp does. However, the problem is in the cleanup process because the same memory address is attempted to be deleted twice.

@turol

turol commented Mar 20, 2023

Copy link
Copy Markdown
Member

Can you share a failing model?

@dmarcinkovic

Copy link
Copy Markdown
Author

Unfortunately, the model I used is proprietary.

@kimkulling

Copy link
Copy Markdown
Member

Will get merged by #5291

@kimkulling kimkulling closed this Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants