Fix Heap buffer overflow in Animation::_find()

Fixes #106647

(cherry picked from commit c317549587)
This commit is contained in:
Jamie Pate
2025-05-20 15:20:00 -07:00
committed by Spartan322
parent 9b22c21b97
commit b12293ebf0

View File

@@ -2443,7 +2443,7 @@ int Animation::_find(const Vector<K> &p_keys, double p_time, bool p_backward, bo
}
}
if (p_limit) {
if (p_limit && middle > -1 && middle < len) {
double diff = length - keys[middle].time;
if ((signbit(keys[middle].time) && !Math::is_zero_approx(keys[middle].time)) || (signbit(diff) && !Math::is_zero_approx(diff))) {
ERR_PRINT_ONCE_ED("Found the key outside the animation range. Consider using the clean-up option in AnimationTrackEditor to fix it.");