SIGN IN SIGN UP

Fix infinite recursion caused by circular asset references in Lottie files

A malicious Lottie JSON file with a self-referencing or mutually
referencing precomp asset (e.g. asset "a" containing a layer with
refId="a") caused infinite recursion in renderer::CompLayer::CompLayer()
via createLayerItem(), crashing the process with SIGSEGV.

Fix: in resolveLayerRefs(), build a directed asset dependency graph
and run BFS from each asset to detect cycles before assigning
mChildren. Any Precomp layer whose refId resolves to a cyclic asset
is skipped, leaving its mChildren empty and rendering nothing instead
of crashing.

Handles both direct self-reference (A → A) and indirect mutual
reference (A → B → A).
M
Michal Szczecinski committed
1cda06022e53206c230fb0c6e38b2adaea729a5d
Parent: 9e4f354
Committed by JoogabYun <40262755+JoogabYun@users.noreply.github.com> on 5/12/2026, 12:36:31 AM