Skip to content

Commit

Permalink
Fixed: Incorrect Read Compressed Header Size when >1 byte.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Jul 20, 2022
1 parent d935919 commit 4a467ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Reloaded.Messaging/Messages/HeaderReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void ReadHeader(Span<byte> data, out sbyte messageType, out int si

if ((messageType & CompressionFlag) == CompressionFlag)
{
sizeAfterDecompression = Unsafe.AsRef<int>(Unsafe.Add(ref MemoryMarshal.GetReference(data), 1));
sizeAfterDecompression = Unsafe.ReadUnaligned<int>(ref Unsafe.Add(ref MemoryMarshal.GetReference(data), 1));
messageType = (sbyte)(messageType ^ CompressionFlag);
if (!BitConverter.IsLittleEndian) // Evaluated at JIT time.
sizeAfterDecompression = BinaryPrimitives.ReverseEndianness(sizeAfterDecompression);
Expand Down

0 comments on commit 4a467ec

Please sign in to comment.