summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-09-05 23:18:27 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-09-05 23:40:33 +0200
commite8d763adc95f74a036232ccbca36b24a662b1256 (patch)
tree6d51bafed4ac0db6f78e88c4fdcbfcd5272c5814 /src
parentab2be7b7e82ea1b0103b70b327137a939df6b8fa (diff)
downloadluaotfload-e8d763adc95f74a036232ccbca36b24a662b1256.tar.gz
[auxiliary] robustify font property lookups
This adresses an issue with entries in the font table that lack the common font structure (manually parsed fonts??). Subtable lookups are now guarded with nil-checks. Reported by Herbert Voss Signed-off-by: Philipp Gesang <phg42.2a@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-auxiliary.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/luaotfload-auxiliary.lua b/src/luaotfload-auxiliary.lua
index 89bf51b..b05d491 100644
--- a/src/luaotfload-auxiliary.lua
+++ b/src/luaotfload-auxiliary.lua
@@ -417,7 +417,9 @@ least one feature.
local provides_script = function (font_id, asked_script)
asked_script = stringlower(asked_script)
if font_id and font_id > 0 then
- local fontdata = identifiers[font_id].shared.rawdata
+ local tfmdata = identifiers[font_id] if not tfmdata then return false end
+ local shared = tfmdata.shared if not shared then return false end
+ local fontdata = shared.rawdata if not fontdata then return false end
if fontdata then
local fontname = fontdata.metadata.fontname
local features = fontdata.resources.features
@@ -455,7 +457,9 @@ local provides_language = function (font_id, asked_script, asked_language)
asked_script = stringlower(asked_script)
asked_language = stringlower(asked_language)
if font_id and font_id > 0 then
- local fontdata = identifiers[font_id].shared.rawdata
+ local tfmdata = identifiers[font_id] if not tfmdata then return false end
+ local shared = tfmdata.shared if not shared then return false end
+ local fontdata = shared.rawdata if not fontdata then return false end
if fontdata then
local fontname = fontdata.metadata.fontname
local features = fontdata.resources.features
@@ -527,7 +531,9 @@ local provides_feature = function (font_id, asked_script,
asked_feature = lpegmatch(strip_garbage, asked_feature)
if font_id and font_id > 0 then
- local fontdata = identifiers[font_id].shared.rawdata
+ local tfmdata = identifiers[font_id] if not tfmdata then return false end
+ local shared = tfmdata.shared if not shared then return false end
+ local fontdata = shared.rawdata if not fontdata then return false end
if fontdata then
local features = fontdata.resources.features
local fontname = fontdata.metadata.fontname