Null pointer Exception with 
org.apache.fontbox.cff.CFFParser$DictData.getEntry(CFFParser.java:626)
--------------------------------------------------------------------------------------------------

                 Key: PDFBOX-703
                 URL: https://issues.apache.org/jira/browse/PDFBOX-703
             Project: PDFBox
          Issue Type: Bug
          Components: FontBox
         Environment: Not an issue, 
            Reporter: [email protected]
            Priority: Minor


The code doesn't crash, however there are a lot of stack dumps in the log file.

The 4 entry in the array below has a null for an operator

org.apache.fontbox.cff.CFFParser$DictData$Entry[operands=[-18, 18, 608, 18, 
-248, 16, 262, 10], operator=BlueValues], 
org.apache.fontbox.cff.CFFParser$DictData$Entry[operands=[240, 2, 114, 0, -576, 
0], operator=OtherBlues], 
org.apache.fontbox.cff.CFFParser$DictData$Entry[operands=[0.0479583], 
operator=BlueScale], 
org.apache.fontbox.cff.CFFParser$DictData$Entry[operands=[0.06], 
operator=null], 
org.apache.fontbox.cff.CFFParser$DictData$Entry[operands=[278], 
operator=defaultWidthX], 
org.apache.fontbox.cff.CFFParser$DictData$Entry[operands=[551], 
operator=nominalWidthX], null, null, null, null

In  the file org.apache.fontbox.cff.CFFParser.java:626  it fails to test for a 
null operator.
I am not sure if the data is incorrect or if the code should just test for a 
null pointer exception.

- Failed to create Type1C font. Falling back to Type1 font
java.lang.NullPointerException
        at 
org.apache.fontbox.cff.CFFParser$DictData.getEntry(CFFParser.java:626)
        at 
org.apache.fontbox.cff.CFFParser$DictData.getEntry(CFFParser.java:619)
        at org.apache.fontbox.cff.CFFParser.getDelta(CFFParser.java:414)
        at org.apache.fontbox.cff.CFFParser.parseFont(CFFParser.java:358)
        at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:66)

Proposed fix would be to test for a null operator and stop the crash.


       private Entry getEntry(CFFOperator operator)
        {
            for (Entry entry : entries)
            {
                // Check for null entry before comparing the Font
                //

                if (entry != null && entry.operator != null && 
                    entry.operator.equals(operator))
                {
                    return entry;
                }
            }
            return null;
        }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to