Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for layer parent-child cycles. #262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

john-preston
Copy link
Contributor

In case of bad input file there could be a cycle in parent-child relationship that leads to stack overflow crash. Simplest case is when the layer is made a parent to itself.

@smohantty
Copy link
Contributor

@john-preston ,
I tried to reproduce your use case in After Effect. But After effect prevents assigning self assignment as well as cyclic parent . I understand maybe user can edit the json file and change the parent id. but then that is applicable to every property inside json file .

I think this fix should go inside the Model so that rendering code will be much simpler to maintain. as less unusual case to handle.

@john-preston
Copy link
Contributor Author

Yes, the idea is to handle without crashing any json file the user offers.

I didn't understand where you think the checks for the cycles should go inside the Model and when should they be performed.

@smohantty
Copy link
Contributor

What I meant is .. this checks should go inside lottieparser so that the renderer dosen't have to deal with all the checks to see if the layer is valid or not. If during resource parsing we find the layer data is corrupted then we can just remove that layer all together.
I have added a patch which checks for assigning parent to itself . you can add the patch to check for
cycle in layer parent tree after parsing the Layers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants