-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/modules/registrypreview/RegistryPreview.FuzzTests/FuzzTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 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 RegistryPreview.FuzzTests | ||
{ | ||
public class FuzzTests | ||
{ | ||
public static void FuzzTargetMethod(ReadOnlySpan<byte> input) | ||
{ | ||
try | ||
{ | ||
// … use input parameter in code under test … | ||
// | ||
// TargetMethod(…); | ||
} | ||
catch (Exception ex) when (ex is ArgumentException) | ||
{ | ||
// This is an example. It's important to filter out any *expected* exceptions from our code here. | ||
// However, catching all exceptions is considered an anti-pattern because it may suppress legitimate | ||
// issues, such as a NullReferenceException thrown by our code. In this case, we still re-throw | ||
// the exception, as the ToJsonFromXmlOrCsvAsync method is not expected to throw any exceptions. | ||
throw; | ||
} | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/modules/registrypreview/RegistryPreview.FuzzTests/MSTestSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)] |
50 changes: 50 additions & 0 deletions
50
src/modules/registrypreview/RegistryPreview.FuzzTests/OneFuzzConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// 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. | ||
{ | ||
"configVersion": 3, | ||
"entries": [ | ||
{ | ||
"fuzzer": { | ||
"$type": "libfuzzerDotNet", | ||
"dll": "RegistryPreview.FuzzTests.dll", | ||
"class": "RegistryPreview.FuzzTests.FuzzTests", | ||
"method": "FuzzTargetMethod", | ||
"FuzzingTargetBinaries": [ | ||
"PowerToys.RegistryPreview.dll" | ||
] | ||
}, | ||
"adoTemplate": { | ||
// supply the values appropriate to your | ||
// project, where bugs will be filed | ||
"org": "microsoft", | ||
"project": "OS", | ||
"AssignedTo": "[email protected]", | ||
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\PowerToys", | ||
"IterationPath": "OS\\Future" | ||
}, | ||
"jobNotificationEmail": "[email protected]", | ||
"skip": false, | ||
"rebootAfterSetup": false, | ||
"oneFuzzJobs": [ | ||
// at least one job is required | ||
{ | ||
"projectName": "RegistryPreview", | ||
"targetName": "RegistryPreview-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) | ||
"RegistryPreview.FuzzTests.dll", | ||
"RegistryPreview.FuzzTests.pdb", | ||
"Microsoft.Windows.SDK.NET.dll", | ||
"Newtonsoft.Json.dll", | ||
"WinRT.Runtime.dll" | ||
], | ||
"SdlWorkItemId": 49911822 | ||
} | ||
] | ||
} |
28 changes: 28 additions & 0 deletions
28
src/modules/registrypreview/RegistryPreview.FuzzTests/RegistryPreview.FuzzTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\tests\RegistryPreview.FuzzTests\</OutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="OneFuzzConfig.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MSTest" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" /> | ||
</ItemGroup> | ||
|
||
</Project> |
b205794
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@check-spelling-bot Report
🔴 Please review
See the 📜action log or 📝 job summary for details.
Unrecognized words (1)
mengyuanchen
These words are not needed and should be removed
AMPROPERTY AMPROPSETID Breadcrumb CDEF comdef ddf devenum DEVMON DEVSOURCE DGR DIIRFLAG dshow DVH DVHD DVSD DVSL EData ERole fdw FILEINFOSIG Filtergraph Filterx HCERTSTORE IKs iljxck IYUV KSPROPERTY lcb ldx lld LONGLONG LTRB majortype makecab MEDIASUBTYPE mediatype mfplat mic mjpg Msimg msiquery ORAW outpin overlaywindow PAUDIO PINDIR Pnp ppmt previouscamera PROPBAG propvarutil reencode reencoded REFGUID REGFILTER REGFILTERPINS REGPINTYPES regsvr shmem sizeread stl strsafe strutil subquery SYNCMFT TMPVAR vcdl vdi vid VIDCAP VIDEOINFOHEADER vih webcam wistd WVCTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the
dev/mengyuanchen/add_onefuzz/registrypreview
branch (ℹ️ how do I use this?):If the flagged items are 🤯 false positives
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt
file matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^
refers to the file's path from the root of the repository, so^README\.md$
would exclude README.md (on whichever branch you're using).well-formed pattern.
If you can write a pattern that would match it,
try adding it to the
patterns.txt
file.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.