Skip to content

fix(exif): handle null byte padding after EXIF segment#24

Open
exoego wants to merge 1 commit intodiegomura:mainfrom
exoego:fix-exif
Open

fix(exif): handle null byte padding after EXIF segment#24
exoego wants to merge 1 commit intodiegomura:mainfrom
exoego:fix-exif

Conversation

@exoego
Copy link

@exoego exoego commented Jan 26, 2026

Some JPEG files have null byte padding between segments that isn't accounted for in the segment length field.
This fix ensures the stream position is correctly advanced and skips any padding bytes.

Many JPEG decoders seem to handle this gracefully by scanning for the next 0xFF marker prefix.
This fix does the same - it's a robustness improvement for real-world malformed files.

This fixes foliojs/pdfkit#1175 and can be an advantage over jpeg-exif.

Note that I proposed jay-peg in foliojs/pdfkit#1678

Copy link
Author

Choose a reason for hiding this comment

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

Note) this image comes from foliojs/pdfkit#1175

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JPEG Image incorrectly reported as having invalid marker

1 participant

Comments