GitHub user icirellik opened a pull request:
https://github.com/apache/pdfbox/pull/31
Infinite Read Loop
When reading an input file using the BufferedRandomAccesssFile an infinite
loop will occur once the buffer is drained and the value `leftover` becomes 0,
since the read method will continue to return 0 as the -1 result from
`fillBuffer()` is never propagated upstream and any code that is executing in a
loop using -1 as an indicator that the file has been fully read will never exit.
An example of where this occurs can be found here:
https://github.com/apache/pdfbox/blob/782ac20dcea7b2e5bb6848f4da9a68c00b4d69a3/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java#L264
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/icirellik/pdfbox infinite-read-loop
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/pdfbox/pull/31.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #31
----
commit 4175de4eca72209a665548fede489da94e8fd958
Author: Cameron Rollhieser <[email protected]>
Date: 2016-11-28T16:53:40Z
Infinite Read Loop
When reading an input file using the BufferedRandomAccesssFile an
infinite loop will occur once the buffer is drained and the value
`leftover` becomes 0, since the read method will continue to return 0 as
the -1 result from `fillBuffer()` is never propagated upstream and any
code that is executing in a loop using -1 as an indicator that the file
has been fully read will never exit.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]