From beb3d4af9fc2b33fb3eacb11d3cde97f6c38e2c2 Mon Sep 17 00:00:00 2001 From: Vadim Pakhnushev Date: Wed, 24 Jul 2013 13:38:17 +0400 Subject: [PATCH] 8008782: NPE in TrueTypeGlyphMapper Reviewed-by: bae, prr --- jdk/src/share/classes/sun/font/TrueTypeFont.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jdk/src/share/classes/sun/font/TrueTypeFont.java b/jdk/src/share/classes/sun/font/TrueTypeFont.java index 5a3180e1546..e5b6ffd4860 100644 --- a/jdk/src/share/classes/sun/font/TrueTypeFont.java +++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java @@ -547,6 +547,17 @@ public class TrueTypeFont extends FileFont { 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()) {