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:42 UTC

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

Author: tilman
Date: Wed Aug  7 05:30:42 2019
New Revision: 1864589

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

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

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java?rev=1864589&r1=1864588&r2=1864589&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java (original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java Wed Aug  7 05:30:42 2019
@@ -151,14 +151,18 @@ class MemoryTTFDataStream extends TTFDat
     
     /**
      * 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.
      */
     @Override
     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;
     }
     
     /**