[
https://issues.apache.org/jira/browse/PDFBOX-2296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14115735#comment-14115735
]
Tilman Hausherr commented on PDFBOX-2296:
-----------------------------------------
The fix I did in the morning won't fix all cases for the old parser, including
the file above: the length value isn't known, but the COSObject is.
createFilteredStream() is called with COSObject ("89 0 R") and the actual
length will be set later. And after that time,
RandomAccessFileOutputStream.getLength() will return a wrong result.
In theory we could fix this by going through all the objects in the PDF, check
which ones are streams and then correct the length. Or we could change
getLength() so that it first returns the written length, and only returns an
expected length if a written length doesn't exist yet.
> Wrong stream length used for truetype font
> ------------------------------------------
>
> Key: PDFBOX-2296
> URL: https://issues.apache.org/jira/browse/PDFBOX-2296
> Project: PDFBox
> Issue Type: Bug
> Components: Parsing
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
>
> The file of PDFBOX-2048 has a wrong encoded font length, it is 4412 in the
> PDF but it is really about 27350. This wrong length is used to read the
> encoded font stream and this results in further trouble (EOF).
> The problem is that the wrong length is passed to createFilteredStream()
> instead of just calling it without parameters. In cosStream.doDecode()
> unFilteredStream = filteredStream (there is a FIXME there!!!), and in
> doDecode(COSName filterName, int filterIndex) unFilteredStream.getLength() is
> used, which returns the expectedLength.
--
This message was sent by Atlassian JIRA
(v6.2#6252)