pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1864533 - in /pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf: HorizontalMetricsTable.java IndexToLocationTable.java VerticalMetricsTable.java
Date Tue, 06 Aug 2019 16:26:46 GMT
Author: tilman
Date: Tue Aug  6 16:26:46 2019
New Revision: 1864533

URL: http://svn.apache.org/viewvc?rev=1864533&view=rev
Log:
PDFBOX-4622: avoid NPE

Modified:
    pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalMetricsTable.java
    pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/IndexToLocationTable.java
    pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/VerticalMetricsTable.java

Modified: pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalMetricsTable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalMetricsTable.java?rev=1864533&r1=1864532&r2=1864533&view=diff
==============================================================================
--- pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalMetricsTable.java
(original)
+++ pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalMetricsTable.java
Tue Aug  6 16:26:46 2019
@@ -50,6 +50,10 @@ public class HorizontalMetricsTable exte
     public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException
     {
         HorizontalHeaderTable hHeader = ttf.getHorizontalHeader();
+        if (hHeader == null)
+        {
+            throw new IOException("Could not get hhea table");
+        }
         numHMetrics = hHeader.getNumberOfHMetrics();
         int numGlyphs = ttf.getNumberOfGlyphs();
 

Modified: pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/IndexToLocationTable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/IndexToLocationTable.java?rev=1864533&r1=1864532&r2=1864533&view=diff
==============================================================================
--- pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/IndexToLocationTable.java
(original)
+++ pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/IndexToLocationTable.java
Tue Aug  6 16:26:46 2019
@@ -50,6 +50,10 @@ public class IndexToLocationTable extend
     public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException
     {
         HeaderTable head = ttf.getHeader();
+        if (head == null)
+        {
+            throw new IOException("Could not get head table");
+        }
         int numGlyphs = ttf.getNumberOfGlyphs();
         offsets = new long[ numGlyphs +1];
         for( int i=0; i<numGlyphs+1; i++ )

Modified: pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/VerticalMetricsTable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/VerticalMetricsTable.java?rev=1864533&r1=1864532&r2=1864533&view=diff
==============================================================================
--- pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/VerticalMetricsTable.java
(original)
+++ pdfbox/branches/issue45/fontbox/src/main/java/org/apache/fontbox/ttf/VerticalMetricsTable.java
Tue Aug  6 16:26:46 2019
@@ -57,6 +57,10 @@ public class VerticalMetricsTable extend
     public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException
     {
         VerticalHeaderTable vHeader = ttf.getVerticalHeader();
+        if (vHeader == null)
+        {
+            throw new IOException("Could not get vhea table");
+        }
         numVMetrics = vHeader.getNumberOfVMetrics();
         int numGlyphs = ttf.getNumberOfGlyphs();
 



Mime
View raw message