Skip to content

Commit

Permalink
Merge pull request #286 from taigacon/master
Browse files Browse the repository at this point in the history
Fix a critical memory out-of-bounds accessing bug of UnsafeDirectBlitResolver
  • Loading branch information
neuecc authored Mar 2, 2020
2 parents 3676b7c + 1bfbb22 commit abd5fc5
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 abd5fc5

Please sign in to comment.