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

NullPointerException in CmapSubtable.getCharCode

    XMLWordPrintableJSON

Details

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

    Description

      Hi,

      I got a NPE in the getCharCode method of CmapSubtable :

      java.lang.NullPointerException: null
       at org.apache.fontbox.ttf.CmapSubtable.getCharCode(CmapSubtable.java:669) ~[fontbox-2.0.25.jar!/:2.0.25]
       at org.apache.fontbox.ttf.CmapSubtable.getCharCodes(CmapSubtable.java:686) ~[fontbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.pdmodel.font.PDType0Font.toUnicode(PDType0Font.java:528) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.contentstream.PDFStreamEngine.showGlyph(PDFStreamEngine.java:811) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.contentstream.PDFStreamEngine.showText(PDFStreamEngine.java:749) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.contentstream.PDFStreamEngine.showTextString(PDFStreamEngine.java:608) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.contentstream.operator.text.ShowText.process(ShowText.java:56) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:939) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:514) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:492) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:155) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.text.LegacyPDFStreamEngine.processPage(LegacyPDFStreamEngine.java:155) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:363) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:291) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:238) ~[pdfbox-2.0.25.jar!/:2.0.25]
       at org.apache.pdfbox.text.PDFTextStripper.getText(PDFTextStripper.java:202) ~[pdfbox-2.0.25.jar!/:2.0.25]

       

      -> It seems, in some cases the glyphIdToCharacterCode array is not instantiated.

      Sorry, but for privacy reason I can't share the PDF which cause this issue.

      Attachments

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              AlbanL Alban
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: