SixLabors / ImageSharp

:camera: A modern, cross-platform, 2D Graphics library for .NET

Home Page:https://sixlabors.com/products/imagesharp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception SixLabors.ImageSharp.ImageFormatException: 'reserved bytes should be zero' when using Image.LoadAsync

gieniowski opened this issue · comments

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

3.1.3

Other ImageSharp packages and versions

Environment (Operating system, version and so on)

Windows 11 with latest updates

.NET Framework version

net8.0.2

Description

I am upgrading version from 3.0.2. Apparently I have an issue when loading image previously created from a particular .jpeg file. Find out the code that reproduces issue below:

using SixLabors.ImageSharp;

await using var pictureStream = File.OpenRead("dwizwcyf.jpeg");

var image = await Image.LoadAsync(pictureStream);

using (var writeStream = File.OpenWrite("result.webp"))
{
    await image.SaveAsWebpAsync(writeStream);
}

var image2 = await Image.LoadAsync("result.webp");

Image.LoadAsync("result.webp") throws this exception SixLabors.ImageSharp.ImageFormatException: 'reserved bytes should be zero'

NOTE: in fact it does not happen in release mode, just debug. I had to mark the checkbox though to create issue. Feel free to ignore it if you find the issue not valuable.

Steps to Reproduce

Open attached jpeg file with imagesharp
Save it as webp
Try to open new webp file again with imagesharp

Images

dwizwcyf

@JimBobSquarePants I did the update to the v3.1.4 and I experience the same behavior. Could you reopen the issue please?