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

ArrayIndexOutOfBoundsException in PreflightParser.lastIndexOf

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.7, 1.8.8, 2.0.0
    • Fix Version/s: 1.8.8, 2.0.0
    • Component/s: Preflight
    • Labels:
      None

      Description

      041278.pdf preflight fail: java.lang.ArrayIndexOutOfBoundsException: 2048
      	at org.apache.pdfbox.preflight.parser.PreflightParser.lastIndexOf(PreflightParser.java:874)
      	at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.getStartxrefOffset(NonSequentialPDFParser.java:786)
      	at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.initialParse(NonSequentialPDFParser.java:406)
      	at org.apache.pdfbox.preflight.parser.PreflightParser.initialParse(PreflightParser.java:244)
      	at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.parse(NonSequentialPDFParser.java:938)
      	at org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:192)
      	at org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:174)
      	at org.apache.pdfbox.preflight.parser.PreflightParser.parse(PreflightParser.java:162)
      	at pdfboxpageimageextraction.PreflightTest.main(PreflightTest.java:41)
      

      The cause is a bug in a check that there is nothing after EOF except one eol. The bug happens if there is only one byte. This has to be rewritten so that:

      • more than 2 bytes: error
      • 2 bytes: 0x0d 0x0a allowed
      • 1 byte: 0x0a allowed

        Attachments

        1. 041278.pdf
          790 kB
          Tilman Hausherr

          Activity

            People

            • Assignee:
              tilman Tilman Hausherr
              Reporter:
              tilman Tilman Hausherr
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: