-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #308 from Arkatufus/master
Version 0.12.2 Release
- Loading branch information
Showing
25 changed files
with
445 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.IO; | ||
using BenchmarkDotNet.Attributes; | ||
using Hyperion.Internal; | ||
|
||
namespace Hyperion.Benchmarks | ||
{ | ||
[Config(typeof(HyperionConfig))] | ||
public class TypeRejectionBenchmark | ||
{ | ||
private Serializer _serializer; | ||
private Stream _dangerousStream; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
var di = new DirectoryInfo("C:\\Windows\\Windows32"); | ||
var serializer = new Serializer(SerializerOptions.Default.WithDisallowUnsafeType(false)); | ||
_dangerousStream = new MemoryStream(); | ||
serializer.Serialize(di, _dangerousStream); | ||
|
||
_serializer = new Serializer(); | ||
} | ||
|
||
[GlobalCleanup] | ||
public void Cleanup() | ||
{ | ||
_dangerousStream.Dispose(); | ||
} | ||
|
||
[Benchmark] | ||
public void DeserializeDanger() | ||
{ | ||
_dangerousStream.Position = 0; | ||
try | ||
{ | ||
_serializer.Deserialize<DirectoryInfo>(_dangerousStream); | ||
} | ||
catch(EvilDeserializationException) | ||
{ | ||
// no-op | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.