-
-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Description
When calling AsepriteFileLoader.FromFile for a specific file, an IndexOutOfRangeException occurs. The exception occurs on line 373 in AsepriteFileLoader.cs when accessing the cel at index cels.Count in the frame targeted by a linked cel. I have been unable to determine what about this file causes the issue. The original file was very large (~3000 layers and ~60 frames) but the layer count at least does not seem to be related. I have pruned the original file to remove as much as possible while preserving the occurrence of the issue. The modified file has 7 layers and 14 frames and the issue persists.
Steps to Reproduce
The exception occurs when attempting to load a specific file.
To reproduce:
- Download and extract the attached zip file (it should contain
test_file_2.ase). - Call
AsepriteFileLoader.FromFileusing the path to the test file.
Alternatively, create a new file with this format:

Then attempt to load that file.
test_files.zip
Expected Behavior
The file should be loaded successfully and without error.
Actual Behavior
An exception occurs.
Exception has occurred: CLR/System.IndexOutOfRangeException
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in System.Private.CoreLib.dll: 'Index was outside the bounds of the array.'
at System.ThrowHelper.ThrowIndexOutOfRangeException()
at System.ReadOnlySpan`1.get_Item(Int32 index)
at AsepriteDotNet.IO.AsepriteFileLoader.LoadFile(String fileName, AsepriteBinaryReader reader, Boolean preMultiplyAlpha) in D:\Data\CS\AseExport\AsepriteDotNet\source\AsepriteDotNet\IO\AsepriteFileLoader.cs:line 373
at AsepriteDotNet.IO.AsepriteFileLoader.FromStream(String fileName, Stream stream, Boolean leaveOpen, Boolean preMultiplyAlpha) in D:\Data\CS\AseExport\AsepriteDotNet\source\AsepriteDotNet\IO\AsepriteFileLoader.cs:line 55
at AsepriteDotNet.IO.AsepriteFileLoader.FromFile(String path, Boolean preMultiplyAlpha) in
Configuration
dotnet v8.0.100
The file has been saved with aseprite v1.3.6 and opens in aseprite without issue.
The issue occurs on windows x64, at least.
Other Information
No response