diff --git a/Directory.Packages.props b/Directory.Packages.props index 1af9962224..e9bc9524e1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -34,6 +34,7 @@ + diff --git a/PowerToys.sln b/PowerToys.sln index 28dc1853ff..5526d8ae47 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -635,6 +635,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkspacesCsharpLibrary", " EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NewPlus.ShellExtension.win10", "src\modules\NewPlus\NewShellExtensionContextMenu.win10\NewPlus.ShellExtension.win10.vcxproj", "{0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvancedPaste.FuzzTests", "src\modules\AdvancedPaste\AdvancedPaste.FuzzTests\AdvancedPaste.FuzzTests.csproj", "{4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -2807,6 +2809,18 @@ Global {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|x64.Build.0 = Release|x64 {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|x86.ActiveCfg = Release|x64 {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|x86.Build.0 = Release|x64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Debug|ARM64.Build.0 = Debug|ARM64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Debug|x64.ActiveCfg = Debug|x64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Debug|x64.Build.0 = Debug|x64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Debug|x86.ActiveCfg = Debug|x64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Debug|x86.Build.0 = Debug|x64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Release|ARM64.ActiveCfg = Release|ARM64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Release|ARM64.Build.0 = Release|ARM64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Release|x64.ActiveCfg = Release|x64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Release|x64.Build.0 = Release|x64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Release|x86.ActiveCfg = Release|x64 + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6}.Release|x86.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3040,6 +3054,7 @@ Global {66614C26-314C-4B91-9071-76133422CFEF} = {B6C42F16-73EB-477E-8B0D-4E6CF6C20AAC} {89D0E199-B17A-418C-B2F8-7375B6708357} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF} {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E} = {CA716AE6-FE5C-40AC-BB8F-2C87912687AC} + {4D079CB1-E2FE-417D-9DB4-9D0B03BC80C6} = {9873BA05-4C41-4819-9283-CF45D795431B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0} diff --git a/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/AdvancedPaste.FuzzTests.csproj b/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/AdvancedPaste.FuzzTests.csproj new file mode 100644 index 0000000000..ef015d645d --- /dev/null +++ b/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/AdvancedPaste.FuzzTests.csproj @@ -0,0 +1,25 @@ + + + + net9.0-windows10.0.22621.0 + latest + enable + enable + + + ..\..\..\..\$(Platform)\$(Configuration)\tests\AdvancedPaste.FuzzTests\ + + + + + + + + + + + + PreserveNewest + + + diff --git a/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/FuzzTests.cs b/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/FuzzTests.cs new file mode 100644 index 0000000000..d7f0c82bed --- /dev/null +++ b/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/FuzzTests.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace AdvancedPaste.FuzzTests +{ + public class FuzzTests + { + public static void ValidatePhoneNumber(string someString) + { + if (someString.Length < 10) + { + return; + } + } + + public static void FuzzPhoneNumber(ReadOnlySpan input) + { + ValidatePhoneNumber(input.ToString()); + } + } +} diff --git a/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/MSTestSettings.cs b/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/MSTestSettings.cs new file mode 100644 index 0000000000..5b05c0b86e --- /dev/null +++ b/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/MSTestSettings.cs @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] diff --git a/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/OneFuzzConfig.json b/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/OneFuzzConfig.json new file mode 100644 index 0000000000..3d37382a27 --- /dev/null +++ b/src/modules/AdvancedPaste/AdvancedPaste.FuzzTests/OneFuzzConfig.json @@ -0,0 +1,40 @@ +{ + "configVersion": 3, + "entries": [ + { + "fuzzer": { + "$type": "libfuzzerDotNet", + "dll": "AdvancedPaste.FuzzTests.dll", + "class": "AdvancedPaste.FuzzTests.FuzzTests", + "method": "FuzzPhoneNumber" + }, + "adoTemplate": { + // supply the values appropriate to your + // project, where bugs will be filed + "org": "microsoft", + "project": "OS", + "AssignedTo": "leilzh@microsoft.com", + "AreaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\PowerToys", + "IterationPath": "OS\\Future" + }, + "jobNotificationEmail": "leilzh@microsoft.com", + "skip": false, + "rebootAfterSetup": false, + "oneFuzzJobs": [ + // at least one job is required + { + "projectName": "AdvancedPaste", + "targetName": "AdvancedPaste-dotnet-fuzzer" + } + ], + "jobDependencies": [ + // this should contain, at minimum, + // the DLL and PDB files + // you will need to add any other files required + // (globs are supported) + "AdvancedPaste.FuzzTests.dll", + "AdvancedPaste.FuzzTests.pdb" + ] + } + ] +}