Repository: microsoft/PowerToys
File: src/modules/fancyzones/FancyZones.FuzzTests/FuzzTests.cs (C#)

Code before:
using static FancyZonesEditorCommon.Data.CustomLayouts;

namespace FancyZones.FuzzTests
{
    public class FuzzTests
    {
        public static void FuzzGridFromJsonElement(ReadOnlySpan<byte> input)
        {
            if (input.Length < 4)
            {
                return;
            }

            int inputData = BitConverter.ToInt32(input.Slice(0, 4));

            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<CustomLayoutListWrapper>(mockCustomLayouts, JsonOptions);
            }
            catch (JsonException)
            {
                return;
            }

            List<CustomLayouts.CustomLayoutWrapper> customLayouts = wrapper.CustomLayouts;

            if (customLayouts == null)
            {
                return;
            }

            foreach (var zoneSet in customLayouts)
            {
                if (zoneSet.Uuid == null || zoneSet.Uuid.Length == 0)

Review comment (suggestion):
Consider splitting the input into multiple values:
int rows = BitConverter.ToInt32(input.Slice(0, 4));
int cols = BitConverter.ToInt32(input.Slice(4, 4));
int spacing = BitConverter.ToInt32(input.Slice(8, 4));
int sensitivity = BitConverter.ToInt32(input.Slice(12, 4));

Code after:
    {
        public static void FuzzGridFromJsonElement(ReadOnlySpan<byte> 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<CustomLayoutListWrapper>(mockCustomLayouts, JsonOptions);
            }
            catch (JsonException)
            {
                return;
            }

            List<CustomLayouts.CustomLayoutWrapper> 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;
                }