-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Prevent crash from importing a certain kind of invalid GLTF #83663
Prevent crash from importing a certain kind of invalid GLTF #83663
Conversation
invalid type: mistach interpolation CUBICSPLINE and value size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not at a computer but the code moves the ternary operator outside indexing operator and adds a check for error. Checked the pattern seems ok but haven’t tested with data. The cubic gltf interpolation is a bit rare and need to check a test case.
Will cause error spam on for example thousands of animation tracks. try printing once
@@ -6224,7 +6224,9 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_ | |||
if (p_remove_immutable_tracks) { | |||
Vector3 base_pos = p_state->nodes[track_i.key]->position; | |||
for (int i = 0; i < track.position_track.times.size(); i++) { | |||
Vector3 value = track.position_track.values[track.position_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i]; | |||
int value_index = track.position_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int value_index = track.position_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE ? (1 + i * 3) : i; | |
int value_index = (track.position_track.interpolation == GLTFAnimation::INTERP_CUBIC_SPLINE) ? (1 + i * 3) : i; |
For readability, same below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, was preparing a batch of approved PRs and I missed this comment.
Thanks! |
Invalid type: mistach interpolation CUBICSPLINE and value size. Might need to change the description and maybe more protections are needed.
Fixes #83617