Coder Social home page Coder Social logo

Exception SixLabors.ImageSharp.ImageFormatException: 'reserved bytes should be zero' when using Image.LoadAsync about imagesharp HOT 7 OPEN

gieniowski avatar gieniowski commented on May 25, 2024
Exception SixLabors.ImageSharp.ImageFormatException: 'reserved bytes should be zero' when using Image.LoadAsync

from imagesharp.

Comments (7)

gieniowski avatar gieniowski commented on May 25, 2024

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

from imagesharp.

hey-red avatar hey-red commented on May 25, 2024

Same issue with v3.1.4.
But I had same behavior both on debug and release mode.

file.zip

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 25, 2024

@hey-red was that file encoded using v3.1.4?

@gieniowski I cannot replicate your issue with the image and code provided with v3.1.4.

WebP files encoded using >= 3.1.0 and < v3.1.4 versions will still trigger an error because the encoder wrote over the reserved bytes.

from imagesharp.

hey-red avatar hey-red commented on May 25, 2024

@JimBobSquarePants Oh, sorry, no. I think this file was taken somewhere from web.
I got same exception "'reserved bytes should be zero'" while loading
using Image image = Image.Load(@"C:\file.webp");

However in browsers/paint.net I can view file without any issues.

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 25, 2024

I could get rid of the exception; it is a violation of the specification but harmless enough.

from imagesharp.

hey-red avatar hey-red commented on May 25, 2024

@JimBobSquarePants I'm not sure if this is the correct line, but it seems that libwebp is simply skip these reserved bytes without error.
https://github.com/webmproject/libwebp/blob/main/src/demux/demux.c#L556

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 25, 2024

Yeah. That's the animated decoder (don't ask why they split everything out). They do the same in the standard one by reading the uint instead of each byte.

https://github.com/webmproject/libwebp/blob/3cada4cef46e1ad2ba47a801ac453af95936dfdb/src/dec/webp_dec.c#L124

I don't know when I'll get round to it personally but if someone wants to PR against the release/v3.1.x branch I'll accept it.

from imagesharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.