From 89dc0c57b41eb6775ac2dafc15ff4d06f4c7b445 Mon Sep 17 00:00:00 2001 From: Jinny You Date: Thu, 24 Jul 2025 23:57:32 +0900 Subject: [PATCH] lottie: fix timeRemap frame boundary handling Fix logic bug in LottieLayer::remap() where timeRemap calculation could exceed frame boundaries. When the calculated mapping frame goes beyond outFrame, now returns the last valid frameNo instead of potentially invalid frame values. This ensures proper frame clamping for timeRemap animations and prevents out-of-bounds frame access. issue: https://github.com/thorvg/thorvg/issues/3591 --- src/loaders/lottie/tvgLottieModel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/loaders/lottie/tvgLottieModel.cpp b/src/loaders/lottie/tvgLottieModel.cpp index 045c7376..440c29cb 100644 --- a/src/loaders/lottie/tvgLottieModel.cpp +++ b/src/loaders/lottie/tvgLottieModel.cpp @@ -697,7 +697,10 @@ float LottieLayer::remap(LottieComposition* comp, float frameNo, LottieExpressio } else { frameNo -= startFrame; } - return (frameNo / timeStretch); + frameNo /= timeStretch; + + if (frameNo > comp->frameCnt()) return cache.frameNo; + return frameNo; }