[ 
https://issues.apache.org/jira/browse/PDFBOX-6386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155663#comment-18155663
 ] 

ASF subversion and git services commented on PDFBOX-6386:
---------------------------------------------------------

Commit 1941386 from Maruan Sahyoun in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1941386 ]

PDFBOX-6386: Limit the number of curls of cloudy borders

Co-Authored-By: Claude <[email protected]>

> Limit the number of curls of cloudy borders
> -------------------------------------------
>
>                 Key: PDFBOX-6386
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6386
>             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
>              Labels: Appearance
>             Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>
> When the appearance of a square, circle or polygon annotation with a cloudy 
> border effect is generated, the number of curls is calculated from the size 
> of the annotation rectangle or the polygon. There is no upper limit, so a 
> small annotation with a huge `/Rect` (e.g. `[0 0 3e12 3e12]`) and without an 
> appearance stream makes PDFBox write an appearance stream with billions of 
> curves, or allocate an array with billions of points for circles. Appearances 
> are generated when such an annotation is rendered, so this ends with an 
> `OutOfMemoryError` or a long stall.
> At the maximum page size, a cloudy border with intensity 1 needs about 7000 
> curls, each curl takes about 170 bytes in the appearance stream.
> Proposed change
>  - Limit the number of curls of a cloudy border to 10000 per annotation
>  - Draw a plain border instead if more curls would be needed, as already done 
> for an intensity of 0
>  - Add tests for a huge cloudy square and circle
> 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]

Reply via email to