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

EOFException during TTF parsing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.24
    • 2.0.25, 3.0.0 PDFBox
    • FontBox
    • None

    Description

      This exception is getting thrown while trying to parse a PDF file.
      I've extracted the problematic TTF file and tried to parse it directly via `TTFParser.parse`.
      The result is the same. The TTF file in question is attached.

      java.io.EOFException
              at org.apache.fontbox.ttf.MemoryTTFDataStream.readSignedShort(MemoryTTFDataStream.java:138)
              at org.apache.fontbox.ttf.VerticalMetricsTable.read(VerticalMetricsTable.java:73)
              at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:361)
              at org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:173)
              at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:150)
              at org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:106)
              at testing.Test.testTtfParsing(Test.java:46)
      

      The code that was used for testing:

      File ttfFile = new File("font-0011.ttf");
      TTFParser ttfParser = new TTFParser(false, false);
      ttfParser.parse(ttfFile);
      

      macOS Preview, Adobe Acrobat Reader DC and Chrome are able to open the PDF file while not falling back to Times New Roman, so font must be parsed correctly.

      Attachments

        1. font-0011.ttf
          44 kB
          Levin Rickert

        Activity

          People

            tilman Tilman Hausherr
            levrik Levin Rickert
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: