trigger: fix NULL dereference and memory leak
Using LuaC API, one can create a callable number - it will be callable and at the same time lua_topointer will return NULL if such number will be passed. And function luaT_event_reset_trigger_with_flags relies on the fact that lua_topointer cannot return NULL if it is called with a callable object. The assumption is wrong, so let's rewrite the function without relying on it. NB: if you are using old trigger API with such exotic handlers, you can have only one such trigger in an event - it will occupy name '0x0'. Closes #9287 NO_CHANGELOG=bugfix for unreleased feature NO_DOC=bugfix
Showing
- src/box/lua/trigger.c 7 additions, 3 deletionssrc/box/lua/trigger.c
- test/box-luatest/CMakeLists.txt 1 addition, 0 deletionstest/box-luatest/CMakeLists.txt
- test/box-luatest/libcallnum.c 24 additions, 0 deletionstest/box-luatest/libcallnum.c
- test/box-luatest/triggers_old_api_test.lua 35 additions, 1 deletiontest/box-luatest/triggers_old_api_test.lua
test/box-luatest/libcallnum.c
0 → 100644
Please register or sign in to comment