Skip to content

Commit dbc40b4

Browse files
committed
Fixed assert while parsing symbol index when member data range includes null padding.
1 parent 1dfa63c commit dbc40b4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Kaisa/ArchiveIndexV1.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ internal ArchiveIndexV1(Archive library, ArchiveMemberHeader header, Stream stre
4141
Symbols = symbolsBuilder.ToImmutable();
4242
AllSymbols = allSymbolsBuilder.MoveToImmutable();
4343

44-
Debug.Assert(stream.Position == expectedEnd);
44+
// Sometimes the section ends "early" and is padded with nulls so we don't want to assert `streamPosition == expectedEnd` here.
45+
Debug.Assert(stream.Position <= expectedEnd);
46+
#if DEBUG
47+
while (stream.Position < expectedEnd)
48+
{ Debug.Assert(stream.Read<byte>() == 0, "Unread symbol index data contained non-null values!"); }
49+
#endif
50+
stream.Position = expectedEnd;
4551
}
4652

4753
public override string ToString()

0 commit comments

Comments
 (0)