fix bundle blocks read failed with ArchiveFlags.BlocksInfoAtTheEnd

Bundle files may be aligned and padding with zeros. Previously `ArchiveFlags.BlocksInfoAtTheEnd` will read the end padding zeros rather than the real block infos, causing decompression errors in following logics.
This commit is contained in:
Loyie King 2024-07-10 19:23:36 +08:00 committed by GitHub
parent 8704feb079
commit 585b69fb36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -298,7 +298,7 @@ namespace AssetStudio
if ((m_Header.flags & ArchiveFlags.BlocksInfoAtTheEnd) != 0)
{
var position = reader.Position;
reader.Position = reader.BaseStream.Length - m_Header.compressedBlocksInfoSize;
reader.Position = m_Header.size - m_Header.compressedBlocksInfoSize;
blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
reader.Position = position;
}