Program.cs 931 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using Emby.Server.Implementations.Library;
  3. using SharpFuzz;
  4. namespace Emby.Server.Implementations.Fuzz
  5. {
  6. public static class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. switch (args[0])
  11. {
  12. case "PathExtensions.TryReplaceSubPath": Run(PathExtensions_TryReplaceSubPath); return;
  13. default: throw new ArgumentException($"Unknown fuzzing function: {args[0]}");
  14. }
  15. }
  16. private static void Run(Action<string> action) => Fuzzer.OutOfProcess.Run(action);
  17. private static void PathExtensions_TryReplaceSubPath(string data)
  18. {
  19. // Stupid, but it worked
  20. var parts = data.Split(':');
  21. if (parts.Length != 3)
  22. {
  23. return;
  24. }
  25. _ = PathExtensions.TryReplaceSubPath(parts[0], parts[1], parts[2], out _);
  26. }
  27. }
  28. }