You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/03/21 12:53:56 UTC
svn commit: r1875492 - in /pdfbox/branches/issue45: ./ pdfbox/
pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
Author: lehmi
Date: Sat Mar 21 12:53:56 2020
New Revision: 1875492
URL: http://svn.apache.org/viewvc?rev=1875492&view=rev
Log:
PDFBOX-4800: use any character but a digit as delimiter when parsing a number
Modified:
pdfbox/branches/issue45/ (props changed)
pdfbox/branches/issue45/pdfbox/ (props changed)
pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
Propchange: pdfbox/branches/issue45/
------------------------------------------------------------------------------
Merged /pdfbox/branches/2.0:r1875490
Propchange: pdfbox/branches/issue45/pdfbox/
------------------------------------------------------------------------------
Merged /pdfbox/branches/2.0/pdfbox:r1875490
Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1875492&r1=1875491&r2=1875492&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java (original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Sat Mar 21 12:53:56 2020
@@ -1369,8 +1369,8 @@ public abstract class BaseParser
}
/**
- * This method is used to read a token by the {@linkplain #readInt()} method
- * and the {@linkplain #readLong()} method.
+ * This method is used to read a token by the {@linkplain #readInt()} and the {@linkplain #readLong()} method. Valid
+ * delimiters are any non digit values.
*
* @return the token to parse as integer or long by the calling method.
* @throws IOException throws by the {@link #seqSource} methods.
@@ -1379,14 +1379,7 @@ public abstract class BaseParser
{
int lastByte;
StringBuilder buffer = new StringBuilder();
- 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 != -1 )
+ while ((lastByte = seqSource.read()) >= '0' && lastByte <= '9')
{
buffer.append( (char)lastByte );
if (buffer.length() > MAX_LENGTH_LONG)