Skip to content

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

@gieniowski

Description

@gieniowski

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions