From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 7D6B8469719 for ; Mon, 21 Sep 2020 20:48:59 +0300 (MSK) From: Sergey Kaplun Date: Mon, 21 Sep 2020 20:48:37 +0300 Message-Id: <20200921174837.30681-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH] cppcheck: src/lua/fiber.c null pointer dereference List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko , Leonid Vasiliev Cc: tarantool-patches@dev.tarantool.org Found and fixed possible null pointer dereference with cppcheck: [src/lua/fiber.c:245] -> [src/lua/fiber.c:217]: (warning) Either the condition 'if(func)' is redundant or there is possible null pointer dereference: func. --- Branch: https://github.com/tarantool/tarantool/tree/skaplun/cppcheck-lua-fiber-possible-null-pointer-dereference src/lua/fiber.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua/fiber.c b/src/lua/fiber.c index 45bc03787..bb6212b24 100644 --- a/src/lua/fiber.c +++ b/src/lua/fiber.c @@ -214,7 +214,7 @@ fiber_backtrace_cb(int frameno, void *frameret, const char *func, size_t offset, { struct lua_fiber_tb_ctx *tb_ctx = (struct lua_fiber_tb_ctx *)cb_ctx; struct lua_State *L = tb_ctx->L; - if (strstr(func, "lj_BC_FUNCC") == func) { + if (func && strstr(func, "lj_BC_FUNCC") == func) { /* We are in the LUA vm. */ lua_Debug ar; while (tb_ctx->R && lua_getstack(tb_ctx->R, tb_ctx->lua_frame, &ar) > 0) { -- 2.28.0