[
https://issues.apache.org/jira/browse/PDFBOX-6383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maruan Sahyoun updated PDFBOX-6383:
-----------------------------------
Fix Version/s: 2.0.38
3.0.9 PDFBox
4.0.0
> Limit the preallocated subroutine list of Type 1 fonts
> ------------------------------------------------------
>
> Key: PDFBOX-6383
> URL: https://issues.apache.org/jira/browse/PDFBOX-6383
> 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 a Type 1 font is parsed, the subroutine list is filled with as many
> empty entries as the `/Subrs` count in the private dictionary declares,
> before any subroutine is read. The count comes from the font, so a small font
> declaring `/Subrs 2147483647 array` makes the parser try to allocate a list
> with billions of entries, which fails with an `OutOfMemoryError` when the
> font is loaded.
> Each subroutine entry (`dup i n RD ... NP`) takes several bytes, so a font
> can't contain more subroutines than its encrypted binary segment has bytes.
> Proposed change
> - Limit the declared `/Subrs` count to the length of the decrypted binary
> segment before allocating the list
> - Log a warning if the count is reduced, and continue parsing
> Found by a Claude security scan.
> 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]