Skip to content

[cmap] Check glyph ids against numGlyphs in format 0 and 14 subtables - #336

Open
iefa-m wants to merge 1 commit into
khaledhosny:mainfrom
iefa-m:cmap-uvs-format0-glyph-bounds
Open

iefa-m wants to merge 1 commit into
khaledhosny:mainfrom
iefa-m:cmap-uvs-format0-glyph-bounds

Conversation

@iefa-m

@iefa-m iefa-m commented Oct 23, 2026

Copy link
Copy Markdown

cmap format 0 and 14 glyph ids are not range-checked

Parse0514 only rejects glyph id 0 in non-default UVS mappings, and Parse100 copies the Mac 1-0-0 glyphIdArray as is, so both can point past numGlyphs and are re-serialized unchanged. With a 7-glyph font carrying a UVS mapping to glyph 60000 (or a format 0 entry mapping A to glyph 200), ots-sanitize reports success and the output keeps the bad id. Formats 4, 12 and 13 already reject this. The two fonts added to tests/fonts/bad are those reproducers; they pass on main and are rejected with this change, and all good fonts still pass.

The format 14 non-default UVS mappings and the Mac 1-0-0 format 0 glyph
array were passed through without a range check, so a sanitized font
could map a character or variation sequence to a glyph id >= numGlyphs.
Reject them the same way formats 4, 12 and 13 already do.
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.

1 participant