Martin Mirchev created PDFBOX-6315:
--------------------------------------

             Summary: StackOverflowError when rendering an optional content 
membership dictionary whose /VE array contains itself
                 Key: PDFBOX-6315
                 URL: https://issues.apache.org/jira/browse/PDFBOX-6315
             Project: PDFBox
          Issue Type: Bug
          Components: Rendering
    Affects Versions: 4.0.0, 3.0.8 PDFBox
            Reporter: Martin Mirchev
         Attachments: ve-self-ref.pdf

{{PageDrawer.isHiddenVisibilityExpression()}} recurses into nested {{/VE}} 
arrays without tracking the
arrays already visited, so a visibility expression that refers to itself 
recurses until the stack
overflows. Minimal file (attached, {{ve-self-ref.pdf}}, 569 bytes):

{code}
5 0 obj <</Type/OCMD/VE 6 0 R>> endobj
6 0 obj [/Not 6 0 R] endobj
% page content: /OC /oc1 BDC 0 0 m 40 40 l S EMC   with /Properties <</oc1 5 0 
R>>
{code}

{{Loader.loadPDF()}} succeeds, then {{new PDFRenderer(doc).renderImage(0)}} 
throws
{{java.lang.StackOverflowError}} (trunk bd0c9c0, 3/3 runs, {{-Xss512k}}; 510 
{{isHiddenVisibilityExpression}}
frames in the trace). A visited set (or a depth limit) around the recursion, 
treating a cyclic
expression as "not hidden", would avoid it.

This issue was found by an LLM-assisted tool and verified manually.




--
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