Skip to content

Commit

Permalink
Fix a critical memory out-of-bounds accessing bug of UnsafeDirectBlit…
Browse files Browse the repository at this point in the history
…Resolver
  • Loading branch information
taigacon committed Mar 1, 2020
1 parent 8c8629d commit 1bfbb22
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializ
byte[] rentMemory = ArrayPool<byte>.Shared.Rent(size);
try
{
var span = rentMemory.AsSpan().Slice(size);
var span = rentMemory.AsSpan().Slice(0, size);
Unsafe.WriteUnaligned(ref span[0], value);
writer.Write(span);
}
Expand Down
2 changes: 1 addition & 1 deletion src/MagicOnion/UnsafeDirectBlitResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void Serialize(ref MessagePackWriter writer, T value, MessagePackSerializ
byte[] rentMemory = ArrayPool<byte>.Shared.Rent(size);
try
{
var span = rentMemory.AsSpan().Slice(size);
var span = rentMemory.AsSpan().Slice(0, size);
Unsafe.WriteUnaligned(ref span[0], value);
writer.Write(span);
}
Expand Down

0 comments on commit 1bfbb22

Please sign in to comment.