From 8368fb213b3356898f3eb7bac328d7f25b4070d3 Mon Sep 17 00:00:00 2001 From: Eugine Blikh <bigbes@tarantool.org> Date: Wed, 28 Jun 2017 15:29:46 +0300 Subject: [PATCH] logging: crash if fmt is not string closes gh-2516 --- src/lua/log.lua | 2 ++ test/app-tap/logger.test.lua | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/lua/log.lua b/src/lua/log.lua index 42c810cc75..584bc2b9d6 100644 --- a/src/lua/log.lua +++ b/src/lua/log.lua @@ -43,6 +43,8 @@ local function say(level, fmt, ...) if not stat then error(fmt, 3) end + elseif type(fmt) ~= 'string' then + fmt = tostring(fmt) end local frame = debug.getinfo(3, "Sl") local line, file = 0, 'eval' diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua index ad891a4c16..10bb2a4d36 100755 --- a/test/app-tap/logger.test.lua +++ b/test/app-tap/logger.test.lua @@ -48,5 +48,7 @@ debug = nil log.info("debug is nil") debug = require('debug') +test:ok(log.info(true) == nil, 'check tarantool crash (gh-2516)') + test:check() os.exit() -- GitLab