Maruan Sahyoun created PDFBOX-6388:
--------------------------------------

             Summary: Read object streams only once
                 Key: PDFBOX-6388
                 URL: https://issues.apache.org/jira/browse/PDFBOX-6388
             Project: PDFBox
          Issue Type: Bug
          Components: Parsing
            Reporter: Maruan Sahyoun
            Assignee: Maruan Sahyoun


When an object is marked as compressed in an object stream, `COSParser` 
decompresses and parses the object stream and caches the objects it contains. 
If the requested object isn't part of the object stream, the whole stream is 
decompressed and parsed again for every such object. A cross reference stream 
may mark a huge number of objects as part of an object stream which doesn't 
contain them, so a small file can make PDFBox decompress the same stream 
millions of times when the document is processed.

Proposed change
 - Read each object stream only once, an object which isn't found in an already 
read object stream isn't part of it
 - Add a test with an xref stream referring to many objects missing in the 
object stream

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]

Reply via email to