You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Kevin Jackson (JIRA)" <ji...@apache.org> on 2010/11/23 06:49:15 UTC

[jira] Updated: (PDFBOX-900) ArrayIndexOutOfBoundsException with extracting labels from malformed document

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

Kevin Jackson updated PDFBOX-900:
---------------------------------

    Attachment: page_label.pdf

> ArrayIndexOutOfBoundsException with extracting labels from malformed document
> -----------------------------------------------------------------------------
>
>                 Key: PDFBOX-900
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-900
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Kevin Jackson
>         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.