Tilman Hausherr created PDFBOX-2498:
---------------------------------------

             Summary: ArrayIndexOutOfBoundsException in 
PreflightParser.lastIndexOf
                 Key: PDFBOX-2498
                 URL: https://issues.apache.org/jira/browse/PDFBOX-2498
             Project: PDFBox
          Issue Type: Bug
          Components: Preflight
    Affects Versions: 1.8.7, 1.8.8, 2.0.0
            Reporter: Tilman Hausherr
             Fix For: 1.8.8, 2.0.0
         Attachments: 041278.pdf

{code}
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)
{code}
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




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to