Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] cppcheck: src/lua/fiber.c null pointer dereference
@ 2020-09-21 17:48 Sergey Kaplun
  2020-09-22  5:07 ` Sergey Kaplun
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sergey Kaplun @ 2020-09-21 17:48 UTC (permalink / raw)
  To: Alexander Turenko, Leonid Vasiliev; +Cc: tarantool-patches

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-28  6:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 17:48 [Tarantool-patches] [PATCH] cppcheck: src/lua/fiber.c null pointer dereference Sergey Kaplun
2020-09-22  5:07 ` Sergey Kaplun
2020-09-23 23:16 ` Alexander Turenko
2020-09-24  9:22   ` Sergey Kaplun
2020-09-24  9:32   ` Alexander Turenko
2020-09-24 11:31     ` Sergey Kaplun
2020-09-28  6:54 ` Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox