Skip to content

Commit

Permalink
Fix debug assertion error in LZ4Stream.Write.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwj committed Aug 5, 2022
1 parent 876dc33 commit 829947d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sources/core/Stride.Core.Serialization/LZ4/LZ4Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public override unsafe void Write(byte[] buffer, int offset, int count)
if (!CanWrite) throw NotSupported("Write");
Debug.Assert(
bufferLength >= 0 &&
(dataBuffer is null || (uint)bufferOffset + (uint)count <= (uint)bufferLength) &&
(dataBuffer is null || (uint)bufferOffset <= (uint)bufferLength) &&
(offset | count) >= 0 &&
(uint)offset + (uint)count <= (uint)buffer.Length);

Expand Down Expand Up @@ -526,7 +526,7 @@ public override unsafe void Write(ReadOnlySpan<byte> buffer)
if (!CanWrite) throw NotSupported("Write");
Debug.Assert(
bufferLength >= 0 &&
(dataBuffer is null || (uint)bufferOffset + (uint)buffer.Length <= (uint)bufferLength));
(dataBuffer is null || (uint)bufferOffset <= (uint)bufferLength));

position += buffer.Length;

Expand Down

0 comments on commit 829947d

Please sign in to comment.