8008782: NPE in TrueTypeGlyphMapper
authorvadim
Wed, 24 Jul 2013 13:38:17 +0400
changeset 19007 1e0c87e7edf7
parent 19006 fcda25164f7d
child 19008 f013dabb0bf8
8008782: NPE in TrueTypeGlyphMapper Reviewed-by: bae, prr
jdk/src/share/classes/sun/font/TrueTypeFont.java
--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java	Mon Jul 22 12:52:15 2013 -0700
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java	Wed Jul 24 13:38:17 2013 +0400
@@ -547,6 +547,17 @@
                     throw new FontFormatException("bad table, tag="+table.tag);
                 }
             }
+
+            if (getDirectoryEntry(headTag) == null) {
+                throw new FontFormatException("missing head table");
+            }
+            if (getDirectoryEntry(maxpTag) == null) {
+                throw new FontFormatException("missing maxp table");
+            }
+            if (getDirectoryEntry(hmtxTag) != null
+                    && getDirectoryEntry(hheaTag) == null) {
+                throw new FontFormatException("missing hhea table");
+            }
             initNames();
         } catch (Exception e) {
             if (FontUtilities.isLogging()) {