Skip to content

Commit

Permalink
Merge pull request #812 from AArnott/fix810_1.9
Browse files Browse the repository at this point in the history
Fix `MessagePackSecurity.GetEqualityComparer<object>` to not return null
  • Loading branch information
AArnott committed Feb 10, 2020
2 parents 1aa93e6 + a1fb68b commit 88dc35a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/MessagePack/MessagePackSecurity.cs
Expand Up @@ -56,6 +56,7 @@ private MessagePackSecurity()
/// </summary>
/// <param name="copyFrom">The template to copy from.</param>
protected MessagePackSecurity(MessagePackSecurity copyFrom)
: this()
{
if (copyFrom is null)
{
Expand Down
7 changes: 7 additions & 0 deletions tests/MessagePack.Tests/MessagePackSecurityTests.cs
Expand Up @@ -125,6 +125,13 @@ public void EqualityComparer_ObjectFallback()
Assert.NotEqual(eq.GetHashCode(o), eq.GetHashCode(new object()));
}

[Fact]
public void EqualityComparer_ObjectFallback_AfterCopyCtor()
{
var security = MessagePackSecurity.UntrustedData.WithMaximumObjectGraphDepth(15);
Assert.NotNull(security.GetEqualityComparer<object>());
}

/// <summary>
/// Verifies that arbitrary other types not known to be hash safe will be rejected.
/// </summary>
Expand Down

0 comments on commit 88dc35a

Please sign in to comment.