Skip to content

Commit

Permalink
Fixed security issues with image sharp.
Browse files Browse the repository at this point in the history
  • Loading branch information
Software Antics committed Apr 17, 2024
1 parent 3cd5304 commit 02bed33
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
26 changes: 13 additions & 13 deletions FinalEngine.Examples.Sponza/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private static void Main()

var watch = new Stopwatch();
var watchInvoker = new StopwatchInvoker(watch);
var gameTime = new GameTime(watchInvoker, 10000.0f);
var gameTime = new GameTime(watchInvoker, 120.0f);

float fieldDepth = 10.0f;
float fieldWidth = 10.0f;
Expand Down Expand Up @@ -189,7 +189,7 @@ private static void Main()
back,
front);

skyboxRenderer.SetSkybox(cubeTexture);
//skyboxRenderer.SetSkybox(cubeTexture);

var controller = new ImGuiController(window.ClientSize.Width, window.ClientSize.Height);

Expand Down Expand Up @@ -223,17 +223,17 @@ private static void Main()

geometryRenderer.Enqueue(model);

for (var i = 0; i < 5; i++)
{
for (var j = 0; j < 5; j++)
{
lightRenderer.Enqueue(new Light()
{
Type = LightType.Point,
Position = new Vector3((i * 20) - 100, 4, (j * 20) - 50),
});
}
}
////for (var i = 0; i < 5; i++)
////{
//// for (var j = 0; j < 5; j++)
//// {
//// lightRenderer.Enqueue(new Light()
//// {
//// Type = LightType.Point,
//// Position = new Vector3((i * 20) - 100, 4, (j * 20) - 50),
//// });
//// }
////}

renderingEngine.Render(camera);

Expand Down
2 changes: 1 addition & 1 deletion FinalEngine.Rendering/FinalEngine.Rendering.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<ItemGroup>
<PackageReference Include="AssimpNet" Version="4.1.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
19 changes: 11 additions & 8 deletions FinalEngine.Rendering/Loaders/Textures/Texture2DResourceLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ public override ITexture2D LoadResource(string filePath)

for (int y = 0; y < image.Height; y++)
{
var row = image.GetPixelRowSpan(y);

for (int x = 0; x < image.Width; x++)
image.ProcessPixelRows(processor =>
{
pixels.Add(row[x].R);
pixels.Add(row[x].G);
pixels.Add(row[x].B);
pixels.Add(row[x].A);
}
for (int x = 0; x < image.Width; x++)
{
var pixel = processor.GetRowSpan(y);

pixels.Add(pixel[x].R);
pixels.Add(pixel[x].G);
pixels.Add(pixel[x].B);
pixels.Add(pixel[x].A);
}
});
}

var rasterState = this.renderDevice.Rasterizer.GetRasterState();
Expand Down
2 changes: 1 addition & 1 deletion FinalEngine.Tests/FinalEngine.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="OpenTK.Core" Version="4.8.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit 02bed33

Please sign in to comment.