Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.12, 2.0.15, 2.0.19
-
None
Description
Short description:
The method readStringNumber in BaseParser.java reads more characters than desired when parsing numbers in certain documents. We have internally fixed the issue by adding the following line (marked with red):
while( (lastByte = seqSource.read() ) != ASCII_SPACE ** &&
lastByte != ASCII_LF ** &&
lastByte != ASCII_CR ** &&
lastByte != 60 && //see sourceforge bug 1714707
__ lastByte != '[' && // PDFBOX-1845
__ lastByte != '(' && // PDFBOX-2579
__ lastByte != 0 && //See sourceforge bug 853328
__ lastByte != '/' &&
lastByte != -1 )
{
Background:
Our customer ran into an issue with certain documents that were converted to PDF/A2 format with Qoppa jPDFPreflight (https://www.qoppa.com/pdfpreflight/). In some instances pdfbox would afterwards fail to open the document.
(It is possible that the Qoppa conversion tool does something wrong and that the resulting PDF is invalid somehow, but all other tools seem to open the converted documents without any problems. We are not PDF experts, so this is difficult for us to judge. If you determine that the problematic PDF document is incorrect somehow, please notify us so that we can create a bug report at Qoppa also.)
I am attaching both an original version of the document (which pdfbox can open just fine) and the converted version (which pdfbox cannot parse correctly).
Additional information
**My colleague refers to ISO 32000-1 section 7.2.2 which describes all valid white-space and delimiter characters for PDF.
According to the list of delimiter/white-space characters the following characters should also be handled in the readStringNumber method: '%','{', ')', ']', '}', '>' , FORM FEED, and HORIZONTAL TAB.
Though again, as we are not experts on the PDF standard we recommend that you check the mentioned standard documents yourself and determine what kind of solution you want to implement (if any).
Final Note:
We are filing this bug report in the hope that you find it helpful. I have tried to include all relevant information as well as I can, if you have further questions, I would be happy to address them as well as I can.