diff --git a/PowerToys.sln b/PowerToys.sln
index 201c0fbefe..1db5745527 100644
--- a/PowerToys.sln
+++ b/PowerToys.sln
@@ -706,6 +706,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegistryPreview.FuzzTests",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.CmdPal.Ext.System", "src\modules\cmdpal\ext\Microsoft.CmdPal.Ext.System\Microsoft.CmdPal.Ext.System.csproj", "{64B88F02-CD88-4ED8-9624-989A800230F9}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FancyZones.FuzzTests", "src\modules\fancyzones\FancyZones.FuzzTests\FancyZones.FuzzTests.csproj", "{0217E86E-3476-9946-DE8E-9D200CEBD47A}"
+EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdPalKeyboardService", "src\modules\cmdpal\CmdPalKeyboardService\CmdPalKeyboardService.vcxproj", "{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRename.FuzzingTest", "src\modules\powerrename\PowerRename.FuzzingTest\PowerRename.FuzzingTest.vcxproj", "{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}"
@@ -2596,6 +2598,14 @@ Global
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|ARM64.ActiveCfg = Release|ARM64
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.ActiveCfg = Release|x64
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.Build.0 = Release|x64
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.Build.0 = Debug|ARM64
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.ActiveCfg = Debug|x64
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.Build.0 = Debug|x64
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.ActiveCfg = Release|ARM64
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.Build.0 = Release|ARM64
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.ActiveCfg = Release|x64
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2866,6 +2876,7 @@ Global
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A0} = {F05E590D-AD46-42BE-9C25-6A63ADD2E3EA}
{5702B3CC-8575-48D5-83D8-15BB42269CD3} = {929C1324-22E8-4412-A9A8-80E85F3985A5}
{64B88F02-CD88-4ED8-9624-989A800230F9} = {ECB8E0D1-7603-4E5C-AB10-D1E545E6F8E2}
+ {0217E86E-3476-9946-DE8E-9D200CEBD47A} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2} = {3846508C-77EB-4034-A702-F8BB263C4F79}
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
EndGlobalSection
diff --git a/src/modules/fancyzones/FancyZones.FuzzTests/FancyZones.FuzzTests.csproj b/src/modules/fancyzones/FancyZones.FuzzTests/FancyZones.FuzzTests.csproj
new file mode 100644
index 0000000000..9890b67217
--- /dev/null
+++ b/src/modules/fancyzones/FancyZones.FuzzTests/FancyZones.FuzzTests.csproj
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+ ..\..\..\..\$(Platform)\$(Configuration)\tests\FancyZones.FuzzTests\
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
diff --git a/src/modules/fancyzones/FancyZones.FuzzTests/FuzzTests.cs b/src/modules/fancyzones/FancyZones.FuzzTests/FuzzTests.cs
new file mode 100644
index 0000000000..3bc846089f
--- /dev/null
+++ b/src/modules/fancyzones/FancyZones.FuzzTests/FuzzTests.cs
@@ -0,0 +1,86 @@
+// 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.
+
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using FancyZonesEditorCommon.Data;
+using FancyZonesEditorCommon.Utils;
+using static FancyZonesEditorCommon.Data.CustomLayouts;
+
+namespace FancyZones.FuzzTests
+{
+ public class FuzzTests
+ {
+ public static void FuzzGridFromJsonElement(ReadOnlySpan input)
+ {
+ if (input.Length < 4)
+ {
+ return;
+ }
+
+ int inputData = BitConverter.ToInt32(input.Slice(0, 4));
+
+ // mock user input for custom-layouts.json
+ string mockCustomLayouts = $@"{{""custom-layouts"": [{{
+ ""uuid"": ""{{B8C275E-A7BC-485F-A35C-67B69164F51F}}"",
+ ""name"": ""Custom layout 1"",
+ ""type"": ""grid"",
+ ""info"": {{
+ ""rows"": {inputData},
+ ""columns"": {inputData},
+ ""rows-percentage"": [ {inputData} ],
+ ""columns-percentage"": [ {inputData}, {inputData}, {inputData} ],
+ ""cell-child-map"": [ [{inputData}, {inputData}, {inputData}] ],
+ ""show-spacing"": true,
+ ""spacing"": {inputData},
+ ""sensitivity-radius"": {inputData}
+ }}
+ }}]}}";
+
+ CustomLayoutListWrapper wrapper;
+ try
+ {
+ wrapper = JsonSerializer.Deserialize(mockCustomLayouts, JsonOptions);
+ }
+ catch (JsonException)
+ {
+ return;
+ }
+
+ List customLayouts = wrapper.CustomLayouts;
+
+ if (customLayouts == null)
+ {
+ return;
+ }
+
+ // Get Layout Info from mockCustomLayouts
+ foreach (var zoneSet in customLayouts)
+ {
+ if (zoneSet.Uuid == null || zoneSet.Uuid.Length == 0)
+ {
+ return;
+ }
+
+ CustomLayouts deserializer = new CustomLayouts();
+
+ // Fuzzing the deserializer
+ _ = deserializer.GridFromJsonElement(zoneSet.Info.GetRawText());
+ }
+ }
+
+ private static JsonSerializerOptions JsonOptions
+ {
+ get
+ {
+ return new JsonSerializerOptions
+ {
+ PropertyNamingPolicy = new DashCaseNamingPolicy(),
+ WriteIndented = true,
+ };
+ }
+ }
+ }
+}
diff --git a/src/modules/fancyzones/FancyZones.FuzzTests/MSTestSettings.cs b/src/modules/fancyzones/FancyZones.FuzzTests/MSTestSettings.cs
new file mode 100644
index 0000000000..5b05c0b86e
--- /dev/null
+++ b/src/modules/fancyzones/FancyZones.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/fancyzones/FancyZones.FuzzTests/OneFuzzConfig.json b/src/modules/fancyzones/FancyZones.FuzzTests/OneFuzzConfig.json
new file mode 100644
index 0000000000..01abd5594e
--- /dev/null
+++ b/src/modules/fancyzones/FancyZones.FuzzTests/OneFuzzConfig.json
@@ -0,0 +1,51 @@
+{
+ "configVersion": 3,
+ "entries": [
+ {
+ "fuzzer": {
+ "$type": "libfuzzerDotNet",
+ "dll": "FancyZones.FuzzTests.dll",
+ "class": "FancyZones.FuzzTests.FuzzTests",
+ "method": "FuzzGridFromJsonElement",
+ "FuzzingTargetBinaries": [
+ "PowerToys.FancyZones.dll"
+ ]
+ },
+ "adoTemplate": {
+ // supply the values appropriate to your
+ // project, where bugs will be filed
+ "org": "microsoft",
+ "project": "OS",
+ "AssignedTo": "mengyuanchen@microsoft.com",
+ "AreaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\PowerToys",
+ "IterationPath": "OS\\Future"
+ },
+ "jobNotificationEmail": "mengyuanchen@microsoft.com",
+ "skip": false,
+ "rebootAfterSetup": false,
+ "oneFuzzJobs": [
+ // at least one job is required
+ {
+ "projectName": "FancyZones",
+ "targetName": "FancyZones-dotnet-fuzzer-FuzzGridFromJsonElement"
+ }
+ ],
+ "jobDependencies": [
+ // this should contain, at minimum,
+ // the DLL and PDB files
+ // you will need to add any other files required
+ // (globs are supported)
+ "FancyZones.FuzzTests.dll",
+ "FancyZones.FuzzTests.pdb",
+ "Microsoft.Windows.SDK.NET.dll",
+ "Newtonsoft.Json.dll",
+ "System.IO.Abstractions.dll",
+ "Testably.Abstractions.FileSystem.Interface.dll",
+ "TestableIO.System.IO.Abstractions.dll",
+ "TestableIO.System.IO.Abstractions.Wrappers.dll",
+ "WinRT.Runtime.dll"
+ ],
+ "SdlWorkItemId": 49911822
+ }
+ ]
+}
\ No newline at end of file