From 2fae2278f70ea5da4763478b54ea420868f96772 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 29 Apr 2019 19:08:00 +0400 Subject: [PATCH] QtLottie: Fix UB in last keyframe easing point. Example: https://lottiefiles.com/427-happy-birthday The present box top was rendered below the body or not depending on the uninitialized bytes from QBezier. --- Telegram/ThirdParty/qtlottie | 2 +- .../QtBodymovin/private/bmspatialproperty_p.h | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Telegram/ThirdParty/qtlottie b/Telegram/ThirdParty/qtlottie index 553ec1bc7..92c5c182f 160000 --- a/Telegram/ThirdParty/qtlottie +++ b/Telegram/ThirdParty/qtlottie @@ -1 +1 @@ -Subproject commit 553ec1bc799f344a12e34c91720e13a469d85365 +Subproject commit 92c5c182fd6578a4f9b2036dc86791da82c2ad6f diff --git a/Telegram/ThirdParty/qtlottie_helper/QtBodymovin/private/bmspatialproperty_p.h b/Telegram/ThirdParty/qtlottie_helper/QtBodymovin/private/bmspatialproperty_p.h index bb5173d56..08280235a 100644 --- a/Telegram/ThirdParty/qtlottie_helper/QtBodymovin/private/bmspatialproperty_p.h +++ b/Telegram/ThirdParty/qtlottie_helper/QtBodymovin/private/bmspatialproperty_p.h @@ -112,9 +112,14 @@ public: int adjustedFrame = qBound(m_startFrame, frame, m_endFrame); if (const EasingSegment *easing = getEasingSegment(adjustedFrame)) { - qreal progress = ((adjustedFrame - m_startFrame) * 1.0) / (m_endFrame - m_startFrame); - qreal easedValue = easing->easing.valueForProgress(progress); - m_value = m_bezierPath.pointAtPercent(easedValue); + if (easing->complete) { + qreal progress = ((adjustedFrame - m_startFrame) * 1.0) / (m_endFrame - m_startFrame); + qreal easedValue = easing->easing.valueForProgress(progress); + m_value = m_bezierPath.pointAtPercent(easedValue); + } else { + // In case of incomplete easing we should just take the final point. + m_value = m_bezierPath.pointAtPercent(1.); + } } return true;