Skip to content

Identify fails on image that can be loaded without errorΒ #1221

@eelke-at-bolt

Description

@eelke-at-bolt

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

Description

When I call SixLabors.ImageSharp.Image.Identify on certain jpeg's this result in the following error.

SixLabors.ImageSharp.InvalidImageContentException: Multiple SOF markers. Only single frame jpegs supported.
   at SixLabors.ImageSharp.Formats.Jpeg.JpegThrowHelper.ThrowInvalidImageContentException(String errorMessage)
   at SixLabors.ImageSharp.Formats.Jpeg.JpegDecoderCore.ProcessStartOfFrameMarker(Int32 remaining, JpegFileMarker& frameMarker, Boolean metadataOnly)
   at SixLabors.ImageSharp.Formats.Jpeg.JpegDecoderCore.ParseStream(Stream stream, Boolean metadataOnly)
   at SixLabors.ImageSharp.Formats.Jpeg.JpegDecoderCore.Identify(Stream stream)
   at SixLabors.ImageSharp.Formats.Jpeg.JpegDecoder.Identify(Configuration configuration, Stream stream)
   at SixLabors.ImageSharp.Image.InternalIdentity(Stream stream, Configuration config)
   at SixLabors.ImageSharp.Image.<>c__DisplayClass87_0.<Identify>b__0(Stream s)
   at SixLabors.ImageSharp.Image.WithSeekableStream[T](Configuration configuration, Stream stream, Func`2 action)
   at SixLabors.ImageSharp.Image.Identify(Configuration configuration, Stream stream, IImageFormat& format)
   at SixLabors.ImageSharp.Image.Identify(Stream stream, IImageFormat& format)
   at SixLabors.ImageSharp.Image.Identify(Stream stream)

Steps to Reproduce

Calling Identify on attached file fails

5acshwaw6agp3q6aoaofe5wvj4kvqcq4

using System;

namespace imageTest
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var img = SixLabors.ImageSharp.Image.Identify(@"5acshwaw6agp3q6aoaofe5wvj4kvqcq4.jpg");
                if (img != null)
                {
                    Console.WriteLine("Succes!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
    }
}

Doing Load on same image succeeds.

System Configuration

  • ImageSharp version: 1.0.0-rc0002
  • Other ImageSharp packages and versions: none
  • Environment (Operating system, version and so on): Windows 10
  • .NET Framework version: .net core 3.1
  • Additional information:

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions