Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#22 Cannot open PDF less than 1024 bytes

closed-fixed
None
5
2011-11-27
2011-10-15
Tyler Bronder
No

Using pdfclown 0.1.0-Alpha, an EOFException is thrown when opening up a file less than 1024 bytes, due to a bug in org.pdfclown.tokens.Parser#retrieveXRefOffset. Ultimately, this will result in a call to java.io.RandomAccessFile#readFully(1024) that triggers an EOFException. I have attached a sample PDF file (generated using pdfclown, naturally) that reproduces this behavior.

Stacktrace:

Caused by: org.pdfclown.tokens.FileFormatException: Unexpected EOF looking for 'startxref' keyword.
at org.pdfclown.tokens.Parser.retrieveXRefOffset(Parser.java:806)
at org.pdfclown.tokens.Parser.retrieveXRefOffset(Parser.java:782)
at org.pdfclown.tokens.Reader.readInfo(Reader.java:120)
at org.pdfclown.files.File.<init>(File.java:186)
at org.pdfclown.files.File.<init>(File.java:172)
at opower.reports.colorvalidation.app.validation.ReadPdf.validateAndGetFile(ReadPdf.java:45)
at opower.reports.colorvalidation.app.validation.ReadPdf.main(ReadPdf.java:20)
... 6 more
Caused by: java.io.EOFException
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:399)
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:377)
at org.pdfclown.bytes.FileInputStream.readString(FileInputStream.java:180)
at org.pdfclown.tokens.Parser.retrieveXRefOffset(Parser.java:804)
... 12 more

Discussion

  • Tyler Bronder
    Tyler Bronder
    2011-10-15

     
    Attachments
    • assigned_to: nobody --> stechio
     
    • status: open --> closed-fixed