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:28 UTC
svn commit: r1864586 -
/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
Author: tilman
Date: Wed Aug 7 05:30:27 2019
New Revision: 1864586
URL: http://svn.apache.org/viewvc?rev=1864586&view=rev
Log:
PDFBOX-4622: check the seek position
Modified:
pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java?rev=1864586&r1=1864585&r2=1864586&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java (original)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java Wed Aug 7 05:30:27 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;
}
/**