From 585b69fb36965792c5dad0cb9da23a99464e2b1d Mon Sep 17 00:00:00 2001 From: Loyie King <724180662@163.com> Date: Wed, 10 Jul 2024 19:23:36 +0800 Subject: [PATCH] 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. --- AssetStudio/BundleFile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AssetStudio/BundleFile.cs b/AssetStudio/BundleFile.cs index 7741fee..5e56826 100644 --- a/AssetStudio/BundleFile.cs +++ b/AssetStudio/BundleFile.cs @@ -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; }