diff --git a/src/lua/cjson.cc b/src/lua/cjson.cc
index d1f3a3269515cb013ffdf463ae9259baeffe5f3d..2ad3c2f2f5be5c6c4ef0b2a05cf7b431c05aa810 100644
--- a/src/lua/cjson.cc
+++ b/src/lua/cjson.cc
@@ -41,6 +41,10 @@ int
 tarantool_lua_cjson_init(struct lua_State *L)
 {
 	luaopen_cjson(L);
+	/* Add NULL constant */
+	lua_pushlightuserdata(L, NULL);
+	lua_setfield(L, -2, "NULL");
+	/* Register module */
 	lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
 	lua_pushstring(L, jsonlib_name); /* add alias */
 	lua_pushvalue(L, -3);
diff --git a/src/lua/msgpack.cc b/src/lua/msgpack.cc
index 0ce4a321e8e7a06b38811e9ed552c19452a9d957..dc85b1137e93e1132675b5ce7232ee00226987aa 100644
--- a/src/lua/msgpack.cc
+++ b/src/lua/msgpack.cc
@@ -417,5 +417,9 @@ luaopen_msgpack(lua_State *L)
 	};
 
 	luaL_register_module(L, "msgpack", msgpacklib);
+	/* Add NULL constant */
+	luaL_loadstring(L, "return require('ffi').cast('void *', 0)");
+	lua_call(L, 0, 1);
+	lua_setfield(L, -2, "NULL");
 	return 1;
 }
diff --git a/src/lua/yaml.cc b/src/lua/yaml.cc
index a909c7894b47d9c569a46f2134d83f37f3bc4663..871cbb7466421d08d66940957e5b192679e677d1 100644
--- a/src/lua/yaml.cc
+++ b/src/lua/yaml.cc
@@ -39,6 +39,12 @@ int
 tarantool_lua_yaml_init(struct lua_State *L)
 {
 	luaopen_yaml(L);
+	/* Fix buggy null() function and add NULL constant */
+	luaL_loadstring(L, "return require('ffi').cast('void *', 0)");
+	lua_pushvalue(L, -1);
+	lua_setfield(L, -3, "null");
+	lua_call(L, 0, 1);
+	lua_setfield(L, -2, "NULL");
 	lua_pop(L, 1); /* yaml module */
 	/* Remove global variable */
 	lua_pushnil(L);
diff --git a/test/box/cjson.result b/test/box/cjson.result
index e7fe97873b753be790c374a5e1ed8091ccf41eca..3288c99e58e57bf3bc0c12aebd8658b31de4d388 100644
--- a/test/box/cjson.result
+++ b/test/box/cjson.result
@@ -43,3 +43,11 @@ json.decode('{\"test\": \"Результат\"}').test
 ---
 - !!binary U5UBCw==
 ...
+json.encode(json.NULL)
+---
+- 'null'
+...
+json.decode(json.encode(json.NULL))
+---
+- null
+...
diff --git a/test/box/cjson.test.lua b/test/box/cjson.test.lua
index 20970e8259299e8b86ca67932848aeaa24736e6f..f679c24f9aa2d96508512b6260d67126a9ff86c6 100644
--- a/test/box/cjson.test.lua
+++ b/test/box/cjson.test.lua
@@ -13,3 +13,6 @@ json.decode('[123, \"Кудыкины горы\"]')[2]
 json.decode('{\"test\": \"Результат\"}').test
 -- parser test to recognize binary stream
 '\83\149\1\11'
+
+json.encode(json.NULL)
+json.decode(json.encode(json.NULL))
diff --git a/test/box/misc.result b/test/box/misc.result
index 997b8b00a7ae1f8f494ee2f204c38d4495dcec4b..9a274fbb14700c50dec717b179ee698df3457456 100644
--- a/test/box/misc.result
+++ b/test/box/misc.result
@@ -602,3 +602,28 @@ ffi.new('struct test', { a = 15 })
 ---
 - - yaml totable test = 15
 ...
+-------------------------------------------------------------------------------
+-- #346 yaml.null() crases server
+-------------------------------------------------------------------------------
+yaml = require('yaml')
+---
+...
+type(yaml.NULL)
+---
+- cdata
+...
+yaml.NULL
+---
+- null
+...
+yaml.NULL == nil
+---
+- true
+...
+yaml.null() -- for compatibility with luaYAML
+---
+- null
+...
+yaml = nil
+---
+...
diff --git a/test/box/misc.test.lua b/test/box/misc.test.lua
index 024806cf08558490ba063068bcd3bf2b709dd7f8..ef01d7bd37bcd1061647e4867fd07611a4f22935 100644
--- a/test/box/misc.test.lua
+++ b/test/box/misc.test.lua
@@ -202,3 +202,16 @@ type(ffi.metatype('struct test', {
 --# setopt delimiter ''
 -- custom totable function will be called by yaml.encode
 ffi.new('struct test', { a = 15 })
+
+
+
+-------------------------------------------------------------------------------
+-- #346 yaml.null() crases server
+-------------------------------------------------------------------------------
+
+yaml = require('yaml')
+type(yaml.NULL)
+yaml.NULL
+yaml.NULL == nil
+yaml.null() -- for compatibility with luaYAML
+yaml = nil
diff --git a/test/box/msgpack.result b/test/box/msgpack.result
index 8a3da18a46d7b5949e7bd184bc02228ecb457e82..34b33ed46be390868f04166da80d7ce4047a9062 100644
--- a/test/box/msgpack.result
+++ b/test/box/msgpack.result
@@ -286,6 +286,30 @@ test(nil)
 ---
 - nil ok
 ...
+type(msgpack.NULL)
+---
+- cdata
+...
+type(msgpackffi.NULL)
+---
+- cdata
+...
+msgpack.NULL == nil
+---
+- true
+...
+msgpackffi.NULL == nil
+---
+- true
+...
+test(msgpack.NULL)
+---
+- 'cdata<void *>: NULL ok'
+...
+test(msgpackffi.NULL)
+---
+- 'cdata<void *>: NULL ok'
+...
 test(ffi.cast('void *', 0))
 ---
 - 'cdata<void *>: NULL ok'
diff --git a/test/box/msgpack.test.lua b/test/box/msgpack.test.lua
index 34091278a7ef2093876b43405bb4de35211e7551..7d97dcdc9821a2134b352cfd90edb2917440efd9 100644
--- a/test/box/msgpack.test.lua
+++ b/test/box/msgpack.test.lua
@@ -158,6 +158,12 @@ test(ffi.new('double', 12.121))
 --------------------------------------------------------------------------------
 
 test(nil)
+type(msgpack.NULL)
+type(msgpackffi.NULL)
+msgpack.NULL == nil
+msgpackffi.NULL == nil
+test(msgpack.NULL)
+test(msgpackffi.NULL)
 
 test(ffi.cast('void *', 0))