SkiaSharp icon indicating copy to clipboard operation
SkiaSharp copied to clipboard

[BUG] System.AccessViolationException throws randomly at SKImage.Subset(SKRectI subset)

Open nihil2881998 opened this issue 2 weeks ago • 0 comments

Description

System.AccessViolationException throws randomly at SKImage.Subset(SKRectI subset)

Skia version with issue: 2.88.6 Last known good version: None

Replication steps: Step1: Install JMeter: Download and install Apache JMeter from below https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.6.3.zip Step2: Open JMeter GUI: Launch JMeter by running the jmeter.bat file located in the bin directory. Step3: Run the application: Download and run the application form below, SkiaTesting.zip Project – ASP.NET Core Target framework - .NET 8.0 Tool - apache-jmeter Step4: Run the Test Plan: Open and run below test plan by clicking on the green Start button in the JMeter GUI. SkiaTesting-TestPlan.zip Step5: Issue will occurs: The issue will occur around 10 minutes.

Code

using SkiaSharp;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

var app = builder.Build();

// Configure the HTTP request pipeline.

app.UseHttpsRedirection();


app.MapGet("/converter", () =>
{
    string ImagePath = Path.GetFullPath(@"Data/image1.jpg");
    using (SKFileStream stream = new SKFileStream(ImagePath))
    {
        SKBitmap bitmap = SKBitmap.Decode(SKData.Create(stream));
        SKImage image = SKImage.FromBitmap(bitmap);
        image = image.Subset(new SKRectI((int)0, (int)0, (int)1306.13, (int)425));
        image.Dispose();
        bitmap.Dispose();

    }
    return Results.Ok();
});

app.Run();

Expected Behavior

No exception.

Actual Behavior

System.AccessViolationException throws randomly at SKImage.Subset(SKRectI subset)

Version of SkiaSharp

Other (Please indicate in the description)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Windows 10 Enterprise

Devices

Windows

Relevant Screenshots

None

Relevant Log Output

None

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

nihil2881998 avatar Jun 26 '24 15:06 nihil2881998