Auditing WOFF 1.0 Table Directory Bounds and Per-Table Zlib Streams
Validating compLength, origLength, and 4-Byte Stream Alignment
Every table inside a WOFF 1.0 file is described by five 32-bit unsigned integers: tag, offset, compLength, origLength, and origChecksum. Per the W3C WOFF 1.0 specification, an encoder may only store a zlib-compressed slice if compLength is strictly smaller than origLength. If deflate overhead makes a tiny table such as maxp or head larger, compLength must equal origLength and the raw table bytes are stored verbatim.
Malformed third-party generators occasionally write compressed streams where compLength exceeds origLength, omit four-byte zero padding between adjacent tables, or miscalculate origChecksum on the head table by forgetting to zero checkSumAdjustment first. Our directory inspector checks every boundary before inflation and compares declared vs recomputed checksums.
- Verifies offset >= 44 + 20 * numTables and offset + compLength <= file byteLength.
- Flags whether each table is stored raw or zlib-deflated inside the WOFF payload.
- Checks inflated byte counts against origLength to catch truncated deflate streams.
- Reports exact hex checksums for every table from cmap and glyf to name and post.