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