From 303b192f6ed69975d507d690caf5a5078708729c 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..9a05dc1d 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; }