[
https://issues.apache.org/jira/browse/PDFBOX-6367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155109#comment-18155109
]
ASF subversion and git services commented on PDFBOX-6367:
---------------------------------------------------------
Commit 1941237 from Maruan Sahyoun in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1941237 ]
PDFBOX-6367: parse each component glyph only once per composite glyph and limit
the composite depth
Co-Authored-By: Claude <[email protected]>
> Parse each component glyph only once per composite glyph and limit the
> composite depth
> --------------------------------------------------------------------------------------
>
> Key: PDFBOX-6367
> URL: https://issues.apache.org/jira/browse/PDFBOX-6367
> Project: PDFBox
> Issue Type: Bug
> Components: FontBox
> Affects Versions: 2.0.37, 3.0.8 PDFBox, 4.0.0
> Reporter: Maruan Sahyoun
> Assignee: Maruan Sahyoun
> Priority: Major
> Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>
> When `GlyphTable` resolves a composite glyph, every component reference is
> parsed again, including all components below it. A composite glyph that
> references the same component twice, or several composites sharing a
> component, therefore multiply the work with each level: a chain of composite
> glyphs that each reference the next one twice costs 2^n glyph parses. The
> glyph cache doesn't prevent this, as it holds only the first 100 glyphs and
> is disabled for fonts that declare 5000 glyphs or more. In addition, the
> maximum nesting depth is taken from the font's own `maxp` table
> (`maxComponentDepth`, up to 65535), so a deep chain of composite glyphs can
> overflow the Java stack. A small embedded font can thereby block rendering of
> a page indefinitely.
> Found by a Claude security scan.
> Proposed change
> - Parse each glyph at most once while a composite glyph is being resolved,
> and reuse it for further references.
> - Limit the composite nesting depth to 16 levels, regardless of the depth
> declared in the `maxp` table.
> - Add regression tests with a crafted font for a composite chain with
> repeated components and for a deep composite chain.
> Claude on behalf of Maruan Sahyoun (msahyoun)
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]