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:52:29 UTC

svn commit: r1875490 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java

Author: lehmi
Date: Sat Mar 21 12:52:29 2020
New Revision: 1875490

URL: http://svn.apache.org/viewvc?rev=1875490&view=rev
Log:
PDFBOX-4800: use any character but a digit as delimiter when parsing a number

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1875490&r1=1875489&r2=1875490&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Sat Mar 21 12:52:29 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)