diff options
| author | Claus Vium <cvium@users.noreply.github.com> | 2021-06-14 19:30:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-14 19:30:05 +0200 |
| commit | cd36b8067fcf80c5ebb47bdd9bea0047d1fe3aef (patch) | |
| tree | b6bd280adfa34931bb47a6d10eb9ddd0bca3b3e3 /fuzz/Jellyfin.Server.Fuzz/Program.cs | |
| parent | aaa9cc604f5cd3a2869259a9b0c404d0330195fd (diff) | |
| parent | f7392394fdcf882c97199d35a65647f201f3129e (diff) | |
Merge pull request #5988 from Bond-009/fuzz
Add fuzzing infrastructure
Diffstat (limited to 'fuzz/Jellyfin.Server.Fuzz/Program.cs')
| -rw-r--r-- | fuzz/Jellyfin.Server.Fuzz/Program.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fuzz/Jellyfin.Server.Fuzz/Program.cs b/fuzz/Jellyfin.Server.Fuzz/Program.cs new file mode 100644 index 000000000..e47286c13 --- /dev/null +++ b/fuzz/Jellyfin.Server.Fuzz/Program.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using Jellyfin.Server.Middleware; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; +using Microsoft.Extensions.Primitives; +using SharpFuzz; + +namespace Emby.Server.Implementations.Fuzz +{ + public static class Program + { + public static void Main(string[] args) + { + switch (args[0]) + { + case "UrlDecodeQueryFeature": Run(UrlDecodeQueryFeature); return; + default: throw new ArgumentException($"Unknown fuzzing function: {args[0]}"); + } + } + + private static void Run(Action<string> action) => Fuzzer.OutOfProcess.Run(action); + + private static void UrlDecodeQueryFeature(string data) + { + var dict = new Dictionary<string, StringValues> + { + { data, StringValues.Empty } + }; + _ = new UrlDecodeQueryFeature(new QueryFeature(new QueryCollection(dict))); + } + } +} |
