<HTML><BODY><div><div>Hi!</div><div> </div><div>Thanks for the review.</div><div> </div><div>Right, sent v2 considering your comments.<br> </div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Понедельник, 20 июля 2020, 13:50 +03:00 от Nikita Pettik <korablev@tarantool.org>:<br> <div id=""><div class="js-helper js-readmsg-msg"><style type="text/css"></style><div><div id="style_15952422571645354416_BODY">On 17 Jul 20:25, Ilya Kosarev wrote:<br>> In case lua_gettop() called from encode_lua_call() returns negative<br>> value, we will segfault in iproto_reply_error() with empty diag, as far<br>> as it is unexpected error path not covered with diagnostics. Thus<br>> corresponding sane check with assert is introduced.<br>><br>> Closes #4649<br>> ---<br>> Branch: <a href="https://github.com/tarantool/tarantool/tree/i.kosarev/gh-4649-sane-check-on-lua_gettop" target="_blank">https://github.com/tarantool/tarantool/tree/i.kosarev/gh-4649-sane-check-on-lua_gettop</a><br>> Issue: <a href="https://github.com/tarantool/tarantool/issues/4649" target="_blank">https://github.com/tarantool/tarantool/issues/4649</a><br>><br>> @ChangeLog:<br>> * Raise assert on lua_gettop() negative return value (gh-4649).<br><br>I guess changelog is likely to be redundant in this case<br>(patch doesnt introduce user-visible changes).<br> <br>> src/box/lua/call.c | 1 +<br>> 1 file changed, 1 insertion(+)<br>><br>> diff --git a/src/box/lua/call.c b/src/box/lua/call.c<br>> index ca871e077..75634de5b 100644<br>> --- a/src/box/lua/call.c<br>> +++ b/src/box/lua/call.c<br>> @@ -361,6 +361,7 @@ encode_lua_call(lua_State *L)<br>><br>> struct luaL_serializer *cfg = luaL_msgpack_default;<br>> int size = lua_gettop(port->L);<br>> + assert(size >= 0);<br><br>I don't understand much in Lua internals, so it would be nice<br>to see rationale for this check. Even if you don't have<br>complete insight concerning it, any thoughts which bring you<br>to this check will be helpful.<br><br>> for (int i = 1; i <= size; ++i)<br>> luamp_encode(port->L, cfg, &stream, i);<br>> port->size = size;<br>> --<br>> 2.17.1<br>></div></div></div></div></blockquote> <div> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>Ilya Kosarev</div></div></div><div> </div></div></BODY></HTML>