Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-2569

COSNumber fails to parse numbers like "+018" in JRE <= 1.6

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.8, 2.0.0
    • 1.8.8, 2.0.0
    • Parsing
    • JRE 1.6 and below.

    Description

      Occasionally I encounter PDFs that have COSNumber's encoded with a preceding plus sign, like "+018", "+1" etc. This is a valid number representation, according to PDF 32000-1:2008 section 7.3.3.

      COSNumber fails to parse these on JDK 1.6 and below. JDK 1.7 and above does not have the problem because Long.parseLong parses these correctly (in JDK 1.6 and below the plus sign would causes a NumberFormatException.)

      I patched COSNumber with a simple fix on 1.8.8 and and verified that the fix worked against the affected PDFs. The bug exists in later versions of PDFBox, including the trunk. I will attach SVN patches for 1.8.8 and the trunk.

      Attachments

        1. 1.8.8-patch.diff
          0.8 kB
          Arthur Blake
        2. trunk-patch.diff
          0.8 kB
          Arthur Blake

        Activity

          People

            tilman Tilman Hausherr
            asf_arthur_blake Arthur Blake
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: