mattiasw / ExifReader

A JavaScript Exif info parser.
Mozilla Public License 2.0
743 stars 89 forks source link

Ensure accurate JPEG offset retrieval by accounting for the length of SOF marker segments #275

Closed robinbisping closed 6 months ago

robinbisping commented 6 months ago

JPEG images can include additional marker segments after SOF marker segments. ExifReader failed to detect these because it did not account for the length of SOF marker segments.

Here is the binary representation of such an image:

Screenshot 2024-03-08 at 13 49 57

I highlighted the markers with red.

Because ExifReader did not reassign the fieldLength for SOF segments, it reapplied the length of the previous marker segment. As a result, appMarkerPosition was out of sync and did not detect the following marker segments.

mattiasw commented 6 months ago

Thanks! Do you have one or a couple of example images where this happens?

robinbisping commented 6 months ago

I sent you an email.

mattiasw commented 6 months ago

Published as version 4.21.1. Thanks for the contribution! I actually had one test file with this issue. I was just on the wrong branch in your fork when testing. 🤦 😄

robinbisping commented 6 months ago

Thank you for looking into this so quickly. 🙏