Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3605

Infinite Read Loop in BufferedRandomAccesssFile

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.3
    • 2.0.4, 3.0.0 PDFBox
    • FontBox
    • None

    Description

      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

      Attachments

        Activity

          People

            tilman Tilman Hausherr
            icirellik Cameron Rollheiser
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: