From e1871f79f8afccc4975a1058780111e637f668a1 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 11 Jul 2024 00:56:13 +0900 Subject: [PATCH] lottie: ++memory access stability Internal matrix can be null. This update prevents such cases by using a safer API. --- src/loaders/lottie/tvgLottieBuilder.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 40163a2c..c042bfbb 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -1125,30 +1125,28 @@ static void _updateText(LottieLayer* layer, float frameNo) if (start > end) std::swap(start, end); if (idx < start || idx >= end) continue; - auto matrix = PP(shape.get())->transform(); + auto matrix = shape->transform(); shape->opacity((*s)->style.opacity(frameNo)); auto color = (*s)->style.fillColor(frameNo); shape->fill(color.rgb[0], color.rgb[1], color.rgb[2], (*s)->style.fillOpacity(frameNo)); - mathRotate(matrix, (*s)->style.rotation(frameNo)); + mathRotate(&matrix, (*s)->style.rotation(frameNo)); auto glyphScale = (*s)->style.scale(frameNo) * 0.01f; - mathScale(matrix, glyphScale.x, glyphScale.y); + mathScale(&matrix, glyphScale.x, glyphScale.y); auto position = (*s)->style.position(frameNo); - mathTranslate(matrix, position.x, position.y); + mathTranslate(&matrix, position.x, position.y); - shape->transform(*matrix); + shape->transform(matrix); if (doc.stroke.render) { auto strokeColor = (*s)->style.strokeColor(frameNo); - shape->stroke((*s)->style.strokeWidth(frameNo) / scale); shape->stroke(strokeColor.rgb[0], strokeColor.rgb[1], strokeColor.rgb[2], (*s)->style.strokeOpacity(frameNo)); } - cursor.x += (*s)->style.letterSpacing(frameNo); }