[
https://issues.apache.org/jira/browse/PDFBOX-6286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tilman Hausherr resolved PDFBOX-6286.
-------------------------------------
Fix Version/s: 2.0.38
3.0.9 PDFBox
4.0.0
Assignee: Tilman Hausherr
Resolution: Fixed
Thank you!
> PDPageTree.get reports false recursion after an out-of-range lookup
> -------------------------------------------------------------------
>
> Key: PDFBOX-6286
> URL: https://issues.apache.org/jira/browse/PDFBOX-6286
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.37, 3.0.8 PDFBox
> Reporter: Aryan Ganjoo
> Assignee: Tilman Hausherr
> Priority: Minor
> Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>
> h3. Observed
> On current PDFBox trunk {{e314c402afd4cac4d60d6d16dbe6525d83637ba8}}, an
> out-of-range {{PDPageTree.get(1)}} on a one-page document throws as expected,
> but a subsequent valid {{get(0)}} on the *same* tree throws
> {{IllegalStateException: Possible recursion found when searching for page
> 1}}. The document is generated in memory and contains no page-tree cycle.
> h3. Minimal reproduction
> {code:java}
> try (PDDocument document = new PDDocument()) {
> PDPage page = new PDPage();
> document.addPage(page);
> PDPageTree pages = document.getPages();
> try { pages.get(1); } catch (IndexOutOfBoundsException expected) { }
> pages.get(0); // unexpectedly reports recursion
> }
> {code}
> h3. Cause and expected behavior
> The lookup keeps visited page dictionaries in an instance field. The failed
> lookup adds the root and exits without clearing that field, so the next
> lookup sees stale state. A fresh lookup should be able to retrieve page zero;
> cycle detection should remain scoped to one traversal. This is separate from
> PDFBOX-3349 (the out-of-range request itself) and PDFBOX-5278 (an
> annotation/type mutation on a particular PDF).
> h3. Local validation and limits
> A regression failed on unmodified trunk and passed with a local candidate
> that uses a per-lookup visited set. The affected {{TestPDPageTree}} class
> passed 8 tests, zero failures/errors. The full suite, stable branches,
> nested-cycle cases, and downstream use were not tested. No private PDF or
> application data was used. This is an issue report, not a submitted patch. AI
> assistance was used for discovery, test and patch preparation, and local
> validation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]