thorvg / thorvg

Thor Vector Graphics is a lightweight portable library used for drawing vector-based scenes and animations including SVG and Lottie. It can be freely utilized across various software platforms and applications to visualize graphical contents.

Home Page:https://www.thorvg.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lottie: invalid memory reference

theashraf opened this issue · comments

This Lottie file contains some base64 inlined png images. For some reason, after passing it to ThorVG, an invalid memory reference error is thrown in dotlottie-rs. I've tested the animation in the ThorVG viewer, and it works fine; however, it doesn't display all the image assets as expected, any ideas ?

Here is the inlined image assets Lottie JSON file
lush3n7n.lottie.json

Related issue: LottieFiles/dotlottie-web#170

Hello, @theashraf.

I have no idea for the runtime error table index is out of bounds.
I just see the call stack points DotLottiePlayer.setFrame. We should make sure whether the exact issue point is from ThorVG or DotLottie.

I've checked the json file. The file doesn't render all inlined images because the attribute "e" is set to 0, which means the asset isn't inlined image.

Screenshot 2024-04-12 at 1 14 21 AM

After replacing all "e":0 to "e":1", the images work well.

Screenshot 2024-04-12 at 1 07 57 AM

I don't understand why lottie-web renders inline images well even with the "e":0 option.
I assume It ignores and only checks data:image/png;base64 header.

However, ThorVG checks that option, so the correct way to render is to set "e":1".

@tinyjin, it's quite challenging to obtain the precise call stack of thorvg due to the multi-level bindings within dotlottie-web. As you mentioned, the issue's origin from the JSON file, where the embed property is expected to be 1 for inlined image assets

Not sure why lottie-web ignores the embed property 😕 , I believe this issue no longer relevant to thorvg in this context

Thank you