Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid crash when generating LODs on meshes with non-finite vertices. #82285

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

lyuma
Copy link
Contributor

@lyuma lyuma commented Sep 25, 2023

Basically just a finite check. I threw in == 0 as well since that would cause a division by zero if it would happen, but I'm not sure if that is possible.

I originally thought #80467 might address this type of issue but it does not: what happens is a nan in a vertex position propagates to the face_area variable which gets cast to int ray_count and this becomes negative. I think this symptom is possibly related to the one aaron fixed (which was likely an integer overflow in that case), but the cause is different.

Fixes V-Sekai/unidot_importer#20
In the case of this fbx mesh, it had three vertices in a face all set to nan. FBX2glTF helpfully preserved these nans in the gltf model. Unfortunately this test model could not be redistributed, so I never filed a Godot issue for this model.

@fire fire requested review from a team September 25, 2023 07:19
@akien-mga akien-mga added bug topic:import crash cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release labels Sep 25, 2023
@akien-mga akien-mga added this to the 4.2 milestone Sep 25, 2023
@akien-mga akien-mga merged commit a9af6af into godotengine:master Sep 25, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Oct 24, 2023
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Godot Crashes Importing Specific Package Files containing NaN vertices
4 participants