PDFStreamParser reads incorrect number (patch provided)
-------------------------------------------------------
Key: PDFBOX-418
URL: https://issues.apache.org/jira/browse/PDFBOX-418
Project: PDFBox
Issue Type: Bug
Components: Parsing
Affects Versions: 0.8.0-incubator
Reporter: Timo Boehme
Fix For: 0.8.0-incubator
With one of our documents PDFBox (compiled Incubator version 2009-02-04) throws
an floating point number exception.
The reason: PDFStreamParser in method parseNextToken() is not strict enough
reading a number. In our case the string read
was '97.-96' which clearly could not be parsed as a number. Thus when parsing a
number (starting at line 238) '+' and '-' should
only be allowed at fist position (maybe one should make sure that '.' can only
be read once).
StringBuffer buf = new StringBuffer();
buf.append( c );
pdfSource.read();
boolean dotNotRead = (c != '.');
while( Character.isDigit(( c = (char)pdfSource.peek()) ) ||
(dotNotRead && (c == '.')) )
{
buf.append( c );
pdfSource.read();
if (dotNotRead && (c == '.'))
dotNotRead = false;
}
retval = COSNumber.get( buf.toString() );
break;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.