You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/08/07 05:30:37 UTC

svn commit: r1864588 - /pdfbox/branches/1.8/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java

Author: tilman
Date: Wed Aug  7 05:30:37 2019
New Revision: 1864588

URL: http://svn.apache.org/viewvc?rev=1864588&view=rev
Log:
PDFBOX-4622: check the seek position

Modified:
    pdfbox/branches/1.8/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java

Modified: pdfbox/branches/1.8/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java?rev=1864588&r1=1864587&r2=1864588&view=diff
==============================================================================
--- pdfbox/branches/1.8/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java (original)
+++ pdfbox/branches/1.8/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java Wed Aug  7 05:30:37 2019
@@ -153,13 +153,17 @@ public class MemoryTTFDataStream extends
     
     /**
      * Seek into the datasource.
-     * 
+     *
      * @param pos The position to seek to.
-     * @throws IOException If there is an error seeking to that position.
+     * @throws IOException If the seek position is negative or larger than MAXINT.
      */
     public void seek(long pos) throws IOException
     {
-        currentPosition = (int)pos;
+        if (pos < 0 || pos > Integer.MAX_VALUE)
+        {
+            throw new IOException("Illegal seek position: " + pos);
+        }
+        currentPosition = (int) pos;
     }
     
     /**