From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:PDF" |
|---|
| claim | "A classic xref entry is read as exactly 20 bytes: 10-digit offset, space, 5-digit generation, space, 'n' (in use) or 'f' (free), then a two-byte line end; qpdf accepts some malformed variants with a warning ("accepting invalid xref table entry")." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "PDF classic cross-reference tables" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "XRefTableEntry" |
|---|
| size | 20 |
|---|
| fields | | offset | "0" |
|---|
| size | 10 |
|---|
| type | "char[10]" |
|---|
| name | "offset" |
|---|
| notes | "decimal byte offset" |
|---|
|
| offset | "11" |
|---|
| size | 5 |
|---|
| type | "char[5]" |
|---|
| name | "generation" |
|---|
| notes | "decimal" |
|---|
|
| offset | "17" |
|---|
| size | 1 |
|---|
| type | "char" |
|---|
| name | "flag" |
|---|
| notes | "n in use, f free" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "m->file->read(line.data(), 20) and the n/f check" |
|---|
| repo | "https://github.com/qpdf/qpdf" |
|---|
| commit | "4eba95899886e851cc41d76886483b347612f2a8" |
|---|
| path | "libqpdf/QPDF_objects.cc" |
|---|
| lines | "731-760" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Classic xref table entry" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T23:42:37.698Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T12:26:38.496Z" |
|---|
| result | "confirmed" |
|---|
| method | "Downloaded libqpdf/QPDF_objects.cc at the cited commit and read Objects::read_xrefEntry: it reads exactly 20 bytes (file->read(line, 20)), parses the offset digits, then the generation, requires 'f' or 'n', and the fallback read_bad_xrefEntry warns damagedPDF("xref table", "accepting invalid xref table entry") when the field lengths are not 10 and 5." |
|---|
|
|
|---|