[ 
https://issues.apache.org/jira/browse/PDFBOX-703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861647#action_12861647
 ] 

[email protected] edited comment on PDFBOX-703 at 4/27/10 10:17 PM:
------------------------------------------------------------------------

Just add a check for null value before comparing the values.


This problem occurred while I was testing loading 1000 pdf files.
Unfortunately this is a copyrighted file in my test and I cannot give you the 
test case to reproduce the problem.

One of the documents which caused the problem is named: 

Bogaard Neolithic Farming in Central Europe An archaeobotanical study of crop 
husbandry practices.pdf


Peter

      was (Author: [email protected]):
    Just add a check for null value before comparing the values.


This problem occurred while I was testing loadinf 1000 pdf files.
Unfortunately this is a copyrighted file in my test and I cannot give you the 
test case to reproduce the problem.

One of the documents which caused the problem is named: 

Bogaard Neolithic Farming in Central Europe An archaeobotanical study of crop 
husbandry practices.pdf


Peter
  
> 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
>         Attachments: PDFBOX-703-CFFParser-nullpointerexception-patch.txt
>
>
> 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