pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1864585 - /pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
Date Wed, 07 Aug 2019 05:30:23 GMT
Author: tilman
Date: Wed Aug  7 05:30:23 2019
New Revision: 1864585

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

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

Modified: pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java?rev=1864585&r1=1864584&r2=1864585&view=diff
==============================================================================
--- pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
(original)
+++ pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
Wed Aug  7 05:30:23 2019
@@ -152,14 +152,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;
     }
     
     /**



Mime
View raw message