diegomura / diegomura/jay-peg

Parsing fails with non-standard APP0

Open
#9 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Some JPEGs have a non-standard APP0 segment. It is non-standard but it breaks parsing because jay-peg assumes fixed size APP0.

I can't give the original image but here's the hex for the broken segment: (includes APP0 marker, two-byte size, and the whole marker data)

```0xFF,0xE0,0x00,0x14,0x4A,0x46,0x49,0x46,0x00,0x01,0x01,0x01,0x01,0x2C,0x01,0x2C,0x00,0x00,0x41,0x4D,0x50,0x46```

The last four bytes spell out `AMPF` in ascii, which according to a [random googling](https://exiftool.org/forum/index.php?topic=12677.0) is somehow related to some Apple extension. See also https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool.pm#L2226

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing jay-peg's APP0 parsing entry point and reproduce the failure with the hexadecimal segment in the issue. The fix is done when this non-standard APP0 segment, including its declared size and trailing AMPF bytes, parses without breaking JPEG decoding.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.