Scanning for the SYNC-SOFn byte pair can incorrectly detect image parameters if the scan false detects the byte pair which will happen if the JPEG has an embedded thumbnail, as the embedded thumbnail is a complete JPEG data structure contained in an EXIF APP chunk at the start of the file.
This patch changes the JPEG parser to skip over chunk internal data using the chunk length bytes.
Scanning for the SYNC-SOFn byte pair can incorrectly detect image parameters if the scan false detects the byte pair which will happen if the JPEG has an embedded thumbnail, as the embedded thumbnail is a complete JPEG data structure contained in an EXIF APP chunk at the start of the file.
This patch changes the JPEG parser to skip over chunk internal data using the chunk length bytes.