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

Adam Nichols resolved PDFBOX-900.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4.0
         Assignee: Adam Nichols

Tested fix and committed to SVN along with a test case to ensure this issue 
doesn't reappear later.  Thanks for the patch and the test file.  Committed in 
revision 1038216.

> ArrayIndexOutOfBoundsException with extracting labels from malformed document
> -----------------------------------------------------------------------------
>
>                 Key: PDFBOX-900
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-900
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.3.1
>            Reporter: Kevin Jackson
>            Assignee: Adam Nichols
>             Fix For: 1.4.0
>
>         Attachments: page_label.pdf
>
>
> This document opens fine in Adobe Reader but inside there is a negative page 
> label offset.  This results in an ArrayIndexOutOfBoundsException  in 
> getLabelsByPageIndices() in PDFBox
> My patch is to ignore that page label.
> ### Eclipse Workspace Patch 1.0
> #P pdfbox
> Index: pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java
> ===================================================================
> --- pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java   
> (revision 1026306)
> +++ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java   
> (working copy)
> @@ -108,7 +108,9 @@
>              Map<Integer, COSDictionary> numbers = node.getNumbers();
>              for (Entry<Integer, COSDictionary> i : numbers.entrySet())
>              {
> -                labels.put(i.getKey(), new PDPageLabelRange(i.getValue()));
> +                if (i.getKey() >= 0) {
> +                    labels.put(i.getKey(), new 
> PDPageLabelRange(i.getValue()));
> +                }
>              }
>          }
>      }

-- 
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