changeset 7693:784589c7bc55

8008782: NPE in TrueTypeGlyphMapper Reviewed-by: bae, prr
author vadim
date Wed, 24 Jul 2013 13:38:17 +0400
parents 2978c0a543ed
children db2e3a686cf3
files src/share/classes/sun/font/TrueTypeFont.java
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/font/TrueTypeFont.java	Mon Jul 22 12:52:15 2013 -0700
+++ b/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()) {