loodakrawa / SpriterDotNet

A pure C# Spriter implementation
zlib License
220 stars 75 forks source link

Stack overflow when using cyclic character map #112

Closed rfadeev closed 3 years ago

rfadeev commented 4 years ago

Consider a following cyclic character map data in the .scml file:

        <character_map id="0" name="test_character_map">
            <map folder="0" file="0" target_folder="0" target_file="1"/>
            <map folder="0" file="1" target_folder="0" target_file="2"/>
            <map folder="0" file="2" target_folder="0" target_file="0"/>
        </character_map>

where cyclic means:

For such character map applied there is infinite recursion happening in SpriterDotNet.Providers.DefaultAssetProvider<T>.Get method.

To reproduce, import following Unity package CharacterMapStackOverflowRepro.zip into example Unity project in the repository SpriterDotNet/SpriterDotNet.Unity. Open imported scene CharMapStackOverflowRepro.unity and either in edit mode or play mode, use context menu item "Push char map and update" of PushCharMapAndUpdate component attached to CharMapStackOverflowRepro game object in the scene to observe infinite recursion.