[tarantool-patches] Re: [PATCH v1 1/1] lua_cjson: fix segfault on recursive table encoding
Kirill Yukhin
kyukhin at tarantool.org
Mon Sep 9 11:03:10 MSK 2019
Hello,
On 19 Aug 15:37, Kirill Shcherbatov wrote:
> The json.encode() used to cause a segfault in case of recursive
> table:
> tbl = {}
> tbl[1] = tbl
> json.encode(tbl)
>
> Library doesn't test whether given object on Lua stack parsed
> earlier, because it performs a lightweight in-depth traverse
> of Lua stack. However it must stop when encode_max_depth is
> reached (by design).
>
> Tarantool's lua_cjson implementation has a bug introduced during
> porting original library: it doesn't handle some corner cases
> checking this constant while original code doesn't have such
> problem. This patch adopts author's approach to check
> encode_max_depth limit. Thanks to handling this constraint
> correctly the segfault no longer occurs.
>
> Closes #4366
> ---
> Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-4366-json-recursive-table-segfault
> Issue: https://github.com/tarantool/tarantool/issues/4366
I've checked your patch into 1.10, 2.1, 2.2 and master.
--
Regards, Kirill Yukhin
More information about the Tarantool-patches
mailing list