Simon Steiner created PDFBOX-6366:
-------------------------------------
Summary: No depth limit on the graphics state stack: a compressed
run of `q` operators exhausts the JVM heap
Key: PDFBOX-6366
URL: https://issues.apache.org/jira/browse/PDFBOX-6366
Project: PDFBox
Issue Type: Bug
Reporter: Simon Steiner
Each q operator in a content stream calls PDFStreamEngine.saveGraphicsState,
which pushes a clone of the current graphics state (with a new text state and
matrix) onto a plain java.util.Stack. There is no maximum depth. Q only pops
when more than one state is on the stack, so unmatched q operators stay in
memory until the page ends. A repeated q compresses extremely well, so a small
file can hold enough of them to keep far more heap than the decoded content's
size (about 100 times, by the finding's estimate). This sits on the path used
by text extraction and rendering.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]