From 9009b998b41085add91e8b90d4c279ee7b6eec1f Mon Sep 17 00:00:00 2001 From: Nemesh Date: Thu, 20 Oct 2022 23:36:02 +0300 Subject: [PATCH] Fixed benchmark upload exploit - fixed a way to set different amount of threads before uploading result to server --- FloatTool/ViewModels/BenchmarkViewModel.cs | 3 ++- FloatTool/Views/BenchmarkWindow.xaml.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/FloatTool/ViewModels/BenchmarkViewModel.cs b/FloatTool/ViewModels/BenchmarkViewModel.cs index c3b546b..62fa1de 100644 --- a/FloatTool/ViewModels/BenchmarkViewModel.cs +++ b/FloatTool/ViewModels/BenchmarkViewModel.cs @@ -51,6 +51,7 @@ public sealed class BenchmarkResult private bool showOnlyCurrent = false; private int multithreadedSpeed = 0; private int threadCount = Environment.ProcessorCount; + public int ThreadCountTested = 0; private int singlethreadedSpeed = 0; private bool isUpdatingEnabled; @@ -225,7 +226,7 @@ public async void PushBenchmarkResults() using var client = new HttpClient(); var version = Assembly.GetExecutingAssembly().GetName().Version; client.DefaultRequestHeaders.Add("User-Agent", $"FloatTool/{AppHelpers.VersionCode}"); - string paramedURL = $"/submit?cpu={CurrentCpuName}&threads={ThreadCount}&multicore={MultithreadedSpeed}&singlecore={SinglethreadedSpeed}"; + string paramedURL = $"/submit?cpu={CurrentCpuName}&threads={ThreadCountTested}&multicore={MultithreadedSpeed}&singlecore={SinglethreadedSpeed}"; HttpResponseMessage response = await client.GetAsync(Utils.API_URL + paramedURL); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); diff --git a/FloatTool/Views/BenchmarkWindow.xaml.cs b/FloatTool/Views/BenchmarkWindow.xaml.cs index 47d4f81..87cf9a8 100644 --- a/FloatTool/Views/BenchmarkWindow.xaml.cs +++ b/FloatTool/Views/BenchmarkWindow.xaml.cs @@ -171,6 +171,7 @@ private void StartBenchmark_Click(object sender, RoutedEventArgs e) Context.MultithreadedSpeed = 0; Context.SinglethreadedSpeed = 0; Context.ProgressPercentage = 0; + Context.ThreadCountTested = Context.ThreadCount; string searchFilter = "0.250000000";