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