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/Emby.Server.Implementations.Fuzz/Program.cs | |
| parent | aaa9cc604f5cd3a2869259a9b0c404d0330195fd (diff) | |
| parent | f7392394fdcf882c97199d35a65647f201f3129e (diff) | |
Merge pull request #5988 from Bond-009/fuzz
Add fuzzing infrastructure
Diffstat (limited to 'fuzz/Emby.Server.Implementations.Fuzz/Program.cs')
| -rw-r--r-- | fuzz/Emby.Server.Implementations.Fuzz/Program.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/fuzz/Emby.Server.Implementations.Fuzz/Program.cs b/fuzz/Emby.Server.Implementations.Fuzz/Program.cs new file mode 100644 index 000000000..a4a6f5f54 --- /dev/null +++ b/fuzz/Emby.Server.Implementations.Fuzz/Program.cs @@ -0,0 +1,32 @@ +using System; +using Emby.Server.Implementations.Library; +using SharpFuzz; + +namespace Emby.Server.Implementations.Fuzz +{ + public static class Program + { + public static void Main(string[] args) + { + switch (args[0]) + { + case "PathExtensions.TryReplaceSubPath": Run(PathExtensions_TryReplaceSubPath); return; + default: throw new ArgumentException($"Unknown fuzzing function: {args[0]}"); + } + } + + private static void Run(Action<string> action) => Fuzzer.OutOfProcess.Run(action); + + private static void PathExtensions_TryReplaceSubPath(string data) + { + // Stupid, but it worked + var parts = data.Split(':'); + if (parts.Length != 3) + { + return; + } + + _ = PathExtensions.TryReplaceSubPath(parts[0], parts[1], parts[2], out _); + } + } +} |
