From e29cda7d304e24bce3ebd3c9721cd42baab3e8b4 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Tue, 15 Apr 2014 16:49:37 +0200 Subject: [PATCH] Fix crash on invalid src.licences data type Signed-off-by: Tobias Ulmer --- local/scm.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/local/scm.lua b/local/scm.lua index 03b3551..43b9968 100644 --- a/local/scm.lua +++ b/local/scm.lua @@ -156,7 +156,7 @@ local function source_apply_default_licences(info, sourcename) " licence attribute is deprecated. Replace by licences.") src.licences = src.licence end - if not src.licences then + if src.licences == nil then e2lib.warnf("WDEFAULT", "in source %s:", src.name) e2lib.warnf("WDEFAULT", " licences attribute missing. Defaulting to empty list.") @@ -167,6 +167,12 @@ local function source_apply_default_licences(info, sourcename) " licences attribute is not in table format. Converting.") src.licences = { src.licences } end + + if type(src.licences) ~= "table" then + e:append("licences attribute is of invalid type") + return false, e + end + for i, s in pairs(src.licences) do if type(i) ~= "number" or type(s) ~= "string" then e:append("licences attribute is not a list of strings") -- 2.39.5