[
https://issues.apache.org/jira/browse/PDFBOX-6370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155169#comment-18155169
]
ASF subversion and git services commented on PDFBOX-6370:
---------------------------------------------------------
Commit 1941255 from Maruan Sahyoun in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1941255 ]
PDFBOX-6370: Limit the number of mappings in cmap subtables
Co-Authored-By: Claude <[email protected]>
> Limit the number of mappings in cmap subtables
> ----------------------------------------------
>
> Key: PDFBOX-6370
> URL: https://issues.apache.org/jira/browse/PDFBOX-6370
> 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
>
>
> Several cmap subtable formats map ranges of character codes: format 4 has
> segments, formats 8, 12 and 13 have groups, format 2 has subheaders. The
> ranges are expanded into one mapping per character code when the font is
> read. Sorted, non-overlapping ranges, as the specification requires, map each
> code at most once. But the ranges are not checked for overlap. A small font
> could contain many ranges that each cover a large part of the code space
> again, e.g. format 13 groups `0..E`, `0..E+1`, `0..E+2`, ... Each 12-byte
> group then adds up to 1,114,112 map operations. This happens when an embedded
> font is loaded, i.e. when a document is opened.
> In 2.0, the check for unsorted format 13 groups was inside the loop over the
> codes of a group. Only the first code of each group was mapped, and a warning
> was logged for every further code.
> Proposed change
> - Limit the mappings of a cmap subtable (formats 2, 4, 8, 12 and 13) to the
> number of character codes (0x110000), summed over all its ranges
> - If a subtable has more, log a warning and ignore the remaining ranges,
> keeping the mappings read so far
> - 2.0: check for unsorted format 13 groups once per group, as in 3.0 and
> trunk
> 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]