[
https://issues.apache.org/jira/browse/PDFBOX-6358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155044#comment-18155044
]
Qiuye Wang commented on PDFBOX-6358:
------------------------------------
Thanks, Tilman. Yes, this is what I had in mind. I checked both commits. If
wrapper construction throws an IOException, the parser now attempts to close
the source and rethrows the original exception. That covers the case I reported.
> 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
> Components: IO
> Affects Versions: 3.0.8 PDFBox
> Reporter: Qiuye Wang
> Assignee: Tilman Hausherr
> Priority: Minor
> Fix For: 3.0.9 PDFBox, 4.0.0
>
>
> 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]