[
https://issues.apache.org/jira/browse/PDFBOX-6385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155808#comment-18155808
]
ASF subversion and git services commented on PDFBOX-6385:
---------------------------------------------------------
Commit 1941445 from Maruan Sahyoun in branch 'pdfbox/branches/3.0'
[ https://svn.apache.org/r1941445 ]
PDFBOX-6385: use PDStream.toByteArray() as suggested by Tilman Hausherr
> Allocate the sample table of type 0 functions from the sample data
> ------------------------------------------------------------------
>
> Key: PDFBOX-6385
> URL: https://issues.apache.org/jira/browse/PDFBOX-6385
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.37, 3.0.8 PDFBox, 4.0.0
> Reporter: Maruan Sahyoun
> Assignee: Maruan Sahyoun
> Priority: Minor
> Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>
> The sample table of a type 0 (sampled) function is allocated with the size
> declared by `/Size` and the number of output values, before the sample stream
> is read. The `/Size` entries come from the document, so a small function
> dictionary with e.g. `/Size [100000000]` and 8 output values makes PDFBox
> allocate several gigabytes when the function is evaluated for the first time,
> e.g. for a shading. The product of the `/Size` entries is also calculated as
> `int`, and an overflow results in an `ArrayIndexOutOfBoundsException` when
> the function is evaluated.
> If the sample stream is shorter than declared, the missing samples are 0 and
> an error is logged. This is kept, but the missing samples don't need to be
> allocated.
> Proposed change
> - Read the sample stream first and allocate only the samples that are in it,
> not all samples declared by `/Size`
> - Return 0 for samples that are missing in the stream, as before
> - Calculate the number of declared samples as `long`
> 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]