Qiuye Wang created PDFBOX-6358:
----------------------------------

             Summary: TTFParser.parse should close its source if constructing 
the data-stream wrapper fails
                 Key: PDFBOX-6358
                 URL: https://issues.apache.org/jira/browse/PDFBOX-6358
             Project: PDFBox
          Issue Type: Bug
    Affects Versions: 3.0.8 PDFBox
            Reporter: Qiuye Wang


Version reviewed: fontbox 3.0.8

TTFParser.parse(RandomAccessRead) documents ownership of the passed source. It 
constructs RandomAccessReadDataStream before entering the cleanup scope. The 
wrapper reads from the source during construction, so a read error at this 
stage exits without closing the source.

Include wrapper construction in the ownership scope. The parser should attempt 
to close the source if initialization fails and preserve the original read 
error.

https://github.com/apache/pdfbox/blob/9286e47d89d6877005c9d2d0f2fd38793a62519a/fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java#L61-L78
https://issues.apache.org/jira/browse/PDFBOX-2986

Based on source inspection. This report was drafted with AI assistance.



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