Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

[bugfix] Pad missing JPEG bytes out to expected file length #3

Merged
merged 3 commits into from
Aug 10, 2022

Conversation

tsmethurst
Copy link
Contributor

This PR fixes an issue where some JPEGs (see new test case) would end up with some bytes missing during the parsing process.

This PR fixes this up by keeping track of the expected file length vs bytes written, during the segment processing, and pads before the EOI with any bytes that went missing. This results in valid, decodable images that keep the same length (as they should).

@tsmethurst tsmethurst merged commit 79f2ed3 into main Aug 10, 2022
@tsmethurst tsmethurst deleted the pad_missing_bytes branch August 10, 2022 12:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant