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

KerningSubtable should skip zero-length kerning subtables

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 2.0.8
    • None
    • FontBox
    • Any
    • Patch

    Description

      DejaVuSansLight has a zero-length kerning subtable. This currently triggers an IOException but it seems to be safe to ignore such tables.

      The simple fix below (the BLOCK ADDED block) makes PDFBox work with fonts like that.

      We must use a locally-patched PDFBox fork as it is paramount to us that it works uninterrupted as much as possible, even with less-than-ideal data.

      private void readSubtable0(TTFDataStream data) throws IOException
          {
              int version = data.readUnsignedShort();
              if (version != 0)
              {
                  LOG.info("Unsupported kerning sub-table version: " + version);
                  return;
              }
              int length = data.readUnsignedShort();
              if (length < 6)
              {
                  if (length == 0) // BLOCK ADDED
                  {
                      LOG.info("Kerning sub-table empty, skipping.");
                      return;
                  }
                  throw new IOException("Kerning sub-table too short, got " + length
                          + " bytes, expect 6 or more.");
              }
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            maxgilead Max Gilead
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: