[
https://issues.apache.org/jira/browse/PDFBOX-6390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155731#comment-18155731
]
ASF subversion and git services commented on PDFBOX-6390:
---------------------------------------------------------
Commit 1941414 from Maruan Sahyoun in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1941414 ]
PDFBOX-6390: Search the file for xref tables and streams only once
Co-Authored-By: Claude <[email protected]>
> Search the file for xref tables and streams only once
> -----------------------------------------------------
>
> Key: PDFBOX-6390
> URL: https://issues.apache.org/jira/browse/PDFBOX-6390
> Project: PDFBox
> Issue Type: Bug
> Components: Parsing
> Affects Versions: 2.0.37, 3.0.8 PDFBox, 4.0.0
> Reporter: Maruan Sahyoun
> Assignee: Maruan Sahyoun
> Priority: Minor
> Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>
> If the offset of a cross reference table or stream is wrong,
> `BruteForceParser` searches the whole file for all xref tables and streams to
> find the nearest one. The results of this search aren't kept, so the whole
> file is searched again for every wrong offset. A file with a long chain of
> xref tables with slightly wrong `/Prev` offsets makes PDFBox search the whole
> file once per xref table when loading it.
> PDFBox 2.0 keeps the results of the search and removes an offset once it was
> used to fix a reference.
> Proposed change
> - Search the file for xref tables and streams only once and keep the
> results, as PDFBox 2.0 does
> - Add a test with a long chain of xref tables with wrong `/Prev` offsets
> 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]