Skip to content

Conversation

@br3aker
Copy link
Contributor

@br3aker br3aker commented Jun 5, 2022

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fixes #2136

Given image contained extra unused bytes right at the end of the SOS segment containing RST markers and 0xFF00 sequences. This lead to non-SOS parser to count them as valid markers and failed with exception. With this PR jpeg decoder now skips any invalid markers during non-SOS parsing so we can at least give the user something instead of exception.

// Read on.
fileMarker = FindNextFileMarker(this.markerBuffer, stream);
fileMarker = FindNextFileMarker(stream);
Console.WriteLine($"Found marker: {fileMarker.Marker} at {fileMarker.Position}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Console.WriteLine is probably a leftover from debugging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups!

Copy link
Collaborator

@brianpopow brianpopow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants