jellyfin/fuzz/Jellyfin.Api.Fuzz/Program.cs

34 lines
985 B
C#
Raw Normal View History

using System;
2021-06-08 20:22:32 +00:00
using System.Collections.Generic;
2023-10-22 15:01:51 +00:00
using Jellyfin.Api.Middleware;
2021-06-08 20:22:32 +00:00
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Primitives;
using SharpFuzz;
2023-10-22 15:01:51 +00:00
namespace Jellyfin.Api.Fuzz
2021-06-08 20:22:32 +00:00
{
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)));
}
}
}