Maruan Sahyoun created PDFBOX-6386:
--------------------------------------
Summary: 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
Reporter: Maruan Sahyoun
Assignee: Maruan Sahyoun
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]