Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Jpeg decoder fails with NullReferenceException from malformed image #2085

Copy link
Copy link

Description

@br3aker
Issue body actions

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

Current main branch

Other ImageSharp packages and versions

None

Environment (Operating system, version and so on)

Windows 10

.NET Framework version

Any supported

Description

Attached jpeg is manually malformed image which doesn't even have a single SOS marker - it ends on incomplete DHT marker which lack a single byte.

However, decoder fails with NullReferenceException at unexpected place - in spectral -> pixel conversion code.

Stacktrace:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.JpegComponentPostProcessor.CopyBlocksToColorBuffer(Int32 spectralStep) in ...\ImageSharp\src\ImageSharp\Formats\Jpeg\Components\Decoder\JpegComponentPostProcessor.cs:line 88
...

Steps to Reproduce

using var img = Image.Load<Rgba32>(path);

Images

corrupted image.zip

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.