-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Essentially, this particular bundle, when opened, will throw while reading the metadata. Here's the stacktrace:
System.ArgumentException: The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'. (Parameter 'chars')
at System.Text.Encoding.ThrowCharsOverflow(DecoderNLS decoder, Boolean nothingDecoded)
at System.Text.Encoding.GetCharsWithFallback(ReadOnlySpan`1 bytes, Int32 originalBytesLength, Span`1 chars, Int32 originalCharsLength, DecoderNLS decoder)
at System.Text.UTF8Encoding.GetCharsWithFallback(ReadOnlySpan`1 bytes, Int32 originalBytesLength, Span`1 chars, Int32 originalCharsLength, DecoderNLS decoder)
at System.Text.Encoding.GetCharsWithFallback(Byte* pOriginalBytes, Int32 originalByteCount, Char* pOriginalChars, Int32 originalCharCount, Int32 bytesConsumedSoFar, Int32 charsWrittenSoFar, DecoderNLS decoder)
at System.Text.DecoderNLS.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, Boolean flush)
at System.Text.Decoder.GetChars(ReadOnlySpan`1 bytes, Span`1 chars, Boolean flush)
at System.IO.BinaryReader.Read()
at System.IO.BinaryReader.ReadChar()
at AssetsTools.NET.AssetsFileReader.ReadNullTerminated() in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\AssetTools.NET\Standard\IO\AssetsFileReader.cs:line 117
at AssetsTools.NET.AssetsFileExternal.Read(AssetsFileReader reader) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\AssetTools.NET\Standard\AssetsFileFormat\AssetsFileExternal.cs:line 41
at AssetsTools.NET.AssetsFileMetadata.Read(AssetsFileReader reader, UInt32 version) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\AssetTools.NET\Standard\AssetsFileFormat\AssetsFileMetadata.cs:line 115
at AssetsTools.NET.AssetsFileMetadata.Read(AssetsFileReader reader, AssetsFileHeader header) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\AssetTools.NET\Standard\AssetsFileFormat\AssetsFileMetadata.cs:line 56
at AssetsTools.NET.AssetsFile.Read(AssetsFileReader reader) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\AssetTools.NET\Standard\AssetsFileFormat\AssetsFile.cs:line 45
at AssetsTools.NET.Extra.AssetsFileInstance..ctor(Stream stream, String filePath) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\AssetTools.NET\Extra\AssetsManager\AssetsFileInstance.cs:line 42
at AssetsTools.NET.Extra.AssetsManager.LoadAssetsFileCacheless(Stream stream, String path, Boolean loadDeps, BundleFileInstance bunInst) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\AssetTools.NET\Extra\AssetsManager\AssetsManager.Assets.cs:line 22
at AssetsTools.NET.Extra.AssetsManager.LoadAssetsFile(String path, Boolean loadDeps) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\AssetTools.NET\Extra\AssetsManager\AssetsManager.Assets.cs:line 94
at Program.<<Main>$>g__Load|0_1(<>c__DisplayClass0_0& ) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\HelloWorld\Program.cs:line 17
at Program.<Main>$(String[] args) in C:\Users\aldelaro5\RiderProjects\AssetsTools.NET\HelloWorld\Program.cs:line 45
While the throw happened trying to read externals assets, the error happens earlier when reading the assets count.
Here's what I observed in the file:
- The header is formatted as expected and reads fine
- The first 8 bytes after the header are all 0 (possible it's 2x int32 ???)
- Next 4 bytes is the assets count (557)
- Then the 557 assets data
- You land right on the external assets count which is 18
- Then the 18 external assets count
- Padding and we land right on the data offset from the header confirming this is a match
The problem is the code expects the type tree count first and IMMEDIATELY thinks the next 4 bytes is the assets count, but this is incorrect: it's being read 4 bytes too early. Additionally, the code expects the script type count after the assets, but that can't be possible: the 557 assets lands PERFECTLY so the external assets count and data follows.
The game is a fangame that's public and uses 4.6.6p3. Here's a link: http://hedgehog.exposed/win
But if you just want the problematic bundle, here: https://drive.google.com/file/d/1LNJVbT3d9vKmXC5I0Z04F9R2qPGtyhYn/view?usp=sharing