From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "magic" |
|---|
| subject | "Format:JPEG" |
|---|
| claim | "Every JPEG interchange-format file (JFIF, Exif, Adobe, bare) starts with the SOI marker FF D8 (only 2 bytes, T.81), normally followed by the FF of the next marker (APP0 E0 for JFIF, APP1 E1 for Exif, APP14 EE for Adobe, or DQT DB / COM FE for bare streams). FF D8 FF is the usual 3-byte sniffing check, but libjpeg-turbo's first_marker reads exactly two bytes and rejects only a first pair other than FF D8 with 'Not a JPEG file: starts with 0x%02x 0x%02x'; it allows no preceding garbage or fill." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:JPEG" |
|---|
| observed_in | |
|---|
|
|---|
| data | | bytes | "FF D8 FF" |
|---|
| offset | 0 |
|---|
| meaning | "SOI marker followed by the first marker segment" |
|---|
|
|---|
| evidence | | type | "documentation" |
|---|
| detail | "ITU-T T.81 Annex B.2.1: a compressed image begins with SOI (X'FFD8') and ends with EOI (X'FFD9')" |
|---|
|
| type | "source" |
|---|
| detail | "first_marker(): reads two bytes c, c2 and calls ERREXIT2(JERR_NO_SOI) unless c == 0xFF && c2 == M_SOI (0xD8); comment: no preceding garbage or fill allowed; the third byte is not examined here" |
|---|
| repo | "https://github.com/libjpeg-turbo/libjpeg-turbo" |
|---|
| commit | "2fa570c514a4b0e70342ef8b32ce1cda21b85710" |
|---|
| path | "src/jdmarker.c" |
|---|
| lines | "936-958" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "All 11 files written by Pillow 12.3.0 (libjpeg-turbo v3.1.4.1) start FF D8 FF E0 (JFIF) or FF D8 FF EE (Adobe, CMYK and keep_rgb files)" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "SOI" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T14:07:20.698Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T12:51:44.086Z" |
|---|
| result | "confirmed" |
|---|
| method | "Fetched src/jdmarker.c at 2fa570c5: first_marker() reads two bytes and ERREXIT2(JERR_NO_SOI) unless c==0xFF and c2==M_SOI; comment forbids preceding garbage or fill; third byte not examined. Matches the corrected claim." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T11:32:58.428Z" |
|---|
| summary | "libjpeg's first_marker checks only the two bytes FF D8, not the third FF" |
|---|
| changed | | "claim" |
| "evidence replaced" |
|
|---|
|
|
|---|