Progressive jpeg with missing EOI marker throws EOFException (Part 2)
Similar to this previously closed Issue, I have JPG files from iPhone 3 and other devices that still gets this error:
Example JPG images: image1.jpg image2.jpg
Using ImageSharp nightly dev NuGet (also tried stable/release which has same issue)
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-dev000642" />
Stack Trace:
SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder.EOFException
HResult=0x80131500
Message=Reached end of stream before proceeding EOI marker!
Source=SixLabors.ImageSharp
StackTrace:
at SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder.DecoderThrowHelper.ThrowExceptionForErrorCode(OrigDecoderErrorCode errorCode)
at SixLabors.ImageSharp.Formats.Jpeg.GolangPort.OrigJpegDecoderCore.ParseStream(Stream stream, Boolean metadataOnly)
at SixLabors.ImageSharp.Formats.Jpeg.JpegDecoder.Decode[TPixel](Configuration configuration, Stream stream)
at AdvisorSolutions360.WebApi.Controllers.AdvisorsController.UpdateReportBranding(Guid advisorId, String PrimaryColor, String SecondaryColor, IFormFile file) in C:\Users\jtubbs\Desktop\code\AdvisorSolutions360.WebApi\Controllers\AdvisorsController.cs:line 160
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
Code I'm using:
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats;
public IActionResult UpdateReportBranding([FromForm] IFormFile file)
{
var ms = new MemoryStream();
file.OpenReadStream().CopyTo(ms);
IImageDecoder decoder = new SixLabors.ImageSharp.Formats.Jpeg.JpegDecoder();
var image = Image.Load(ms, decoder); << EXCEPTION
Workaround As mentioned in Issue #18, I can add a try/catch to "fix" this issue
Hi @justintubbs
Thanks for the info, Can you fix those image links please so I can have a look at them. I'm getting a 403 error.
@antonfirsov Looking at the codebase it looks like we are not calling the EnsureNoEOF at any point but rather EnsureNoError without checking to see wther we have image data first.
Is anyone else having issues getting to these photos? I can view them in multiple browsers, even in Incognito/Private browsing mode


@justintubbs Those attached images are pngs?
@justintubbs Can you provide the appropriate jpegs please? Otherwise I'm going to have to close this issue.
Thanks!
Sorry for my 2c, I was looking for issues on github similar to what we had with JPEG and stumbled on this thread.
Thanks for the great library!
Looks like links from the opening comment are working and there are JPEG images there. Not sure if these are the images that caused issue.
@alexsorokoletov You can see them? Great!
Can you do me a huge favor and add them in a zip file to this thread? We're all getting 403 Forbidden statuses when trying to view the images.
Here you go :) Image1and2.zip
Thanks for that! I can confirm that both images work perfectly with the latest nightlies.
Closing this issue.