Parcourir la source

Fix Heap buffer overflow in Animation::_find()

Fixes #106647
Jamie Pate il y a 2 mois
Parent
commit
c317549587
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      scene/resources/animation.cpp

+ 1 - 1
scene/resources/animation.cpp

@@ -2441,7 +2441,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 ((std::signbit(keys[middle].time) && !Math::is_zero_approx(keys[middle].time)) || (std::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.");