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

ArrayIndexOutOfBoundsException in PreflightParser.lastIndexOf

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.7, 1.8.8, 2.0.0
    • 1.8.8, 2.0.0
    • Preflight
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: