From 6e2951cee1e9eb64e766aa35fe82fbc02c9c8110 Mon Sep 17 00:00:00 2001 From: Benjamin Carleski Date: Tue, 21 Jul 2020 10:34:09 -0700 Subject: [PATCH] Handle FileBlockSize values > 4096 when reading --- .../IO/TransactedCompoundFile.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs b/src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs index 506b50b..c7f4dbb 100644 --- a/src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs +++ b/src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs @@ -191,12 +191,12 @@ public enum LoadingRule /// public static uint FirstIdentity { get { return 1; } } - const int BlockHeaderSize = 16; //length + CRC + const int BlockHeaderSize = 17; //Header Size + Length + CRC + Block Count + Block Id private const int OffsetOfHeaderSize = 0; - private const int OffsetOfLength = 0; - private const int OffsetOfCrc32 = 4; - private const int OffsetOfBlockCount = 8; - private const int OffsetOfBlockId = 12; + private const int OffsetOfLength = 1; + private const int OffsetOfCrc32 = 5; + private const int OffsetOfBlockCount = 9; + private const int OffsetOfBlockId = 13; readonly Options _options; readonly int BlockSize; @@ -895,7 +895,7 @@ public Stream Read(ref BlockRef block, bool headerOnly, FGet fget) throw new InvalidDataException(); headerSize = bytes[OffsetOfHeaderSize]; - length = (int) GetUInt32(bytes, OffsetOfLength) & 0x00FFFFFF; + length = (int) GetUInt32(bytes, OffsetOfLength); block.ActualBlocks = (int) GetUInt32(bytes, OffsetOfBlockCount); uint blockId = GetUInt32(bytes, OffsetOfBlockId);