lottie: hotfix memory corruption.

revise the fix that occured a side effect by:
287e6d33d2
This commit is contained in:
Hermet Park 2024-04-03 16:02:07 +09:00 committed by Hermet Park
parent a4a585d8f0
commit 622b25a3b4

View file

@ -383,10 +383,7 @@ struct LottieGradient : LottieObject
uint32_t populate(ColorStop& color)
{
colorStops.populated = true;
if (!color.input || color.input->count % 4 != 0) {
TVGERR("LOTTIE", "The given colorstop value is not correct!");
return 0;
}
if (!color.input) return 0;
uint32_t alphaCnt = (color.input->count - (colorStops.count * 4)) / 2;
Array<Fill::ColorStop> output(colorStops.count + alphaCnt);
@ -434,7 +431,7 @@ struct LottieGradient : LottieObject
}
//color remains
while (cidx < clast) {
while (cidx + 3 < clast) {
cs.offset = (*color.input)[cidx];
cs.r = lroundf((*color.input)[cidx + 1] * 255.0f);
cs.g = lroundf((*color.input)[cidx + 2] * 255.0f);