summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-09-19 20:13:30 +0300
committerKhaled Hosny <khaledhosny@eglug.org>2010-09-19 20:13:30 +0300
commite05cbf8d7d512840e943bb62875a104d46c37701 (patch)
tree773290721343b5c464397fc4815c34d70aa1e365
parent0e63b6f673544a52078da0981a245d6a03ab9dbd (diff)
downloadluaotfload-e05cbf8d7d512840e943bb62875a104d46c37701.tar.gz
Reject fonts missing 'names' table
Fonts should always have a names table, I suppose, so if not we should reject the font. Reported by Philipp Stephani.
-rw-r--r--otfl-font-nms.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index 1f37d16..938b6bd 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -257,7 +257,7 @@ local function font_fullinfo(filename, subfont, texmf)
if trace_loading then
logs.report("error: failed to open %s", filename)
end
- return nil
+ return
end
local m = fontloader.to_table(f)
fontloader.close(f)
@@ -284,6 +284,12 @@ local function font_fullinfo(filename, subfont, texmf)
}
end
end
+ else
+ -- no names table, propably a broken font
+ if trace_loading then
+ logs.report("broken font rejected: %s", basefile)
+ end
+ return
end
t.fontname = m.fontname
t.fullname = m.fullname
@@ -345,6 +351,9 @@ local function load_font(filename, fontnames, newfontnames, texmf)
if type(info) == "table" and #info > 1 then
for i in next, info do
local fullinfo = font_fullinfo(filename, i-1, texmf)
+ if not fullinfo then
+ return
+ end
local index = newstatus[basefile].index[i]
if newstatus[basefile].index[i] then
index = newstatus[basefile].index[i]
@@ -356,6 +365,9 @@ local function load_font(filename, fontnames, newfontnames, texmf)
end
else
local fullinfo = font_fullinfo(filename, false, texmf)
+ if not fullinfo then
+ return
+ end
local index
if newstatus[basefile].index[1] then
index = newstatus[basefile].index[1]