AndreRenaud / PDFGen

Simple C PDF Writer/Generation library
The Unlicense
493 stars 118 forks source link

Update JPEG parser #114

Closed mcgouganp closed 2 years ago

mcgouganp commented 2 years ago

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.