You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2013/03/24 15:35:15 UTC

[jira] [Updated] (PDFBOX-891) Malformed document causes NPE in PDNameTreeNode.getValue

     [ https://issues.apache.org/jira/browse/PDFBOX-891?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler updated PDFBOX-891:
--------------------------------------

    Fix Version/s: 1.4.0
    
> Malformed document causes NPE in PDNameTreeNode.getValue
> --------------------------------------------------------
>
>                 Key: PDFBOX-891
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-891
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.3.1
>            Reporter: Kevin Jackson
>            Assignee: Adam Nichols
>             Fix For: 1.4.0
>
>
> If a NameTreeNode has neither a Names or Kids item, then getValue crashes with a Null Pointer Exception.
> Fix:
> ### Eclipse Workspace Patch 1.0
> #P pdfbox
> Index: pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java
> ===================================================================
> --- pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java	(revision 1026306)
> +++ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java	(working copy)
> @@ -147,13 +147,15 @@
>          else
>          {
>              List kids = getKids();
> -            for( int i=0; i<kids.size() && retval == null; i++ )
> -            {
> -                PDNameTreeNode childNode = (PDNameTreeNode)kids.get( i );
> -                if( childNode.getLowerLimit().compareTo( name ) <= 0 &&
> -                        childNode.getUpperLimit().compareTo( name ) >= 0 )
> +            if (kids != null) {
> +                for( int i=0; i<kids.size() && retval == null; i++ )
>                  {
> -                    retval = childNode.getValue( name );
> +                    PDNameTreeNode childNode = (PDNameTreeNode)kids.get( i );
> +                    if( childNode.getLowerLimit().compareTo( name ) <= 0 &&
> +                            childNode.getUpperLimit().compareTo( name ) >= 0 )
> +                    {
> +                        retval = childNode.getValue( name );
> +                    }
>                  }
>              }
>          }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira