[
https://issues.apache.org/jira/browse/PDFBOX-2008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tilman Hausherr updated PDFBOX-2008:
------------------------------------
Affects Version/s: 2.0.0
1.8.5
> Off-by-one error in BaseParser.readGenerationNumber()
> -----------------------------------------------------
>
> Key: PDFBOX-2008
> URL: https://issues.apache.org/jira/browse/PDFBOX-2008
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 1.8.4, 1.8.5, 2.0.0
> Reporter: Christian S.
> Fix For: 1.8.5, 2.0.0
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> wrong:
> if(retval < 0 || retval >= GENERATION_NUMBER_THRESHOLD) ...
> correct:
> if(retval < 0 || retval > GENERATION_NUMBER_THRESHOLD) ...
> The method comment describes the correct behavior:
> "if the integer value has more than the maximum object revision (i.e. :
> bigger than {@link #GENERATION_NUMBER_THRESHOLD}) ..."
> This is not a theoretical bug. I've scanned our database of quite a few pdf
> documents and found one which were not readable / mergeable by PdfBox:
> java.io.IOException: Generation Number '65535' has more than 5 digits
> at
> org.apache.pdfbox.pdfparser.BaseParser.readGenerationNumber(BaseParser.java:1629)
> at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:574)
> at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:194)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1219)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1186)
> at
> org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:191)
>
--
This message was sent by Atlassian JIRA
(v6.2#6252)